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.
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.
$ curl "https://api.vultr.com/v2/vpcs" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a GET
request to the List Instances endpoint and note the target instance's ID.
$ curl "https://api.vultr.com/v2/instances" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
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.
$ curl "https://api.vultr.com/v2/vpc2/{vpc-id}/nodes/attach" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
{
"nodes": [
"<instance-id>"
]
}
View the list of VPC 2.0 networks in your Vultr account and note the target network's ID.
$ vultr-cli vpc2 list
View the all instances and note your target instance's ID.
$ vultr-cli instance list
Attach the VPC 2.0 network to the instance.
$ vultr-cli vpc2 nodes attach <vpc2 id> \
--nodes="<instance id>"