How to Attach a VPC 2.0 Network to a Vultr Instance

Updated on September 25, 2024

Attaching a VPC 2.0 network to an instance enables a new private networking interface that supports communication with other nodes on the same network. You can attach multiple VPC 2.0 networks to an instance to enable connections with other hosts on each subnet.

Follow this guide to attach a VPC 2.0 network to a Vultr instance using the Vultr API or CLI.

  • Vultr API
  • Vultr CLI
  1. Send a GET request to the List VPC 2.0 networks endpoint and note the target VPC 2.0 network's ID in your output.

    console
    $ curl "https://api.vultr.com/v2/vpcs" \
       -X GET \
      -H "Authorization: Bearer ${VULTR_API_KEY}"
    
  2. Send a GET request to the List Instances endpoint and note the target instance's ID.

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

    console
    $ curl "https://api.vultr.com/v2/vpc2/{vpc-id}/nodes/attach" \
        -X GET \
        -H "Authorization: Bearer ${VULTR_API_KEY}" 
        {
        "nodes": [
          "<instance-id>"
        ]
        }
    
  1. View the list of VPC 2.0 networks in your Vultr account and note the target network's ID.

    console
    $ vultr-cli vpc2 list
    
  2. View the all instances and note your target instance's ID.

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

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