How to Attach VPC 2.0 Networks on a Vultr Optimized Cloud Compute Instance

Updated on September 25, 2024

A Vultr Virtual Private Cloud (VPC) 2.0 network enables a secure and isolated private networking interface on your instance to enable communication with other instances on the same network. You can attach multiple VPC 2.0 networks to enable communication between an instance and other nodes attached to the same network.

Follow this guide to attach VPC 2.0 networks on a Vultr Optimized Cloud Compute instance using the Vultr Customer Portal, API, or CLI.

  • Vultr Customer Portal
  • Vultr API
  • Vultr CLI
  1. Navigate to Products and click Compute.

    Vultr Customer Portal

  2. Click your target instance to open its management page.

    View active instance subscriptions

  3. Navigate to the Settings tab.

    Navigate to the Settings Tab

  4. Click VPC 2.0 on the left navigation menu.

    Access VPC 2.0

  5. Click Enable VPC 2.0 to activate a new VPC 2.0 network interface.

  6. Click Enable VPC 2.0 in the confirmation prompt to apply changes and attach a new VPC 2.0 network to your instance.

    Attach VPC 2.0

  7. Click the VPC 2.0 drop-down to select a specific network and click Attach to apply changes.

    Select a specific VPC 2.0 network

  1. Send a GET request to the List Instances endpoint and note the target instance's ID in your output.

    console
    $ curl "https://api.vultr.com/v2/instances" \
      -X GET \
      -H "Authorization: Bearer ${VULTR_API_KEY}"
    
  2. Send a GET request to the List Instance VPC 2.0 Networks endpoint to list all VPC 2.0 networks in your Vultr account and note the target VPC network's ID.

    console
    $ curl "https://api.vultr.com/v2/instances/{instance-id}/vpc2" \
      -X GET \
      -H "Authorization: Bearer ${VULTR_API_KEY}"
    
  3. Send a POST request to the Attach VPC 2.0 to Instance endpoint to attach a VPC 2.0 network to the instance.

    console
    $ curl "https://api.vultr.com/v2/instances/{instance-id}/vpc2/attach" \
      -X POST \
      -H "Authorization: Bearer ${VULTR_API_KEY}" \
      -H "Content-Type: application/json" \
      --data '{
        "vpc_id": "<vpc-id>"
      }'
    
  1. List all instances in your Vultr account and note the target instance's ID.

    console
    $ vultr-cli instance list
    
  2. List all VPC 2.0 networks in your Vultr account and note the target VPC 2.0 network's ID.

    console
    $ vultr-cli vpc2 list
    
  3. Attach the VPC 2.0 network to the instance.

    console
    $ vultr-cli vpc2 nodes attach <vpc2-id> \
            --nodes="<instance-id>"