A Virtual Private Cloud (VPC) 2.0 network enables a secure and isolated private networking interface on your instance for communication with other instances in the same network. You can attach multiple VPC networks to enable communication between an instance and other nodes attached to the same network.
Follow this guide to attach VPC networks on a Vultr Optimized Cloud Compute instance using the Vultr Customer Portal, API, or CLI.
Navigate to Products and click Compute.
Click your target instance to open its management page.
Navigate to the Settings tab.
Click IPv4 on the left navigation menu.
Click the VPC Network drop-down, select a VPC network and click Attach.
Click Attach VPC in the confirmation prompt to apply changes to your instance.
Send a GET
request to the List Instances endpoint and note the target instance's ID in your output.
$ curl "https://api.vultr.com/v2/instances" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a GET
request to the List VPCs endpoint to list all VPCs in your Vultr account and note the target VPC network's ID.
$ curl "https://api.vultr.com/v2/vpcs" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a POST
request to the Attach VPC to Instance endpoint to attach the VPC network the instance.
$ curl "https://api.vultr.com/v2/instances/{instance-id}/vpcs/attach" \
-X POST \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"vpc_id": "<vpc-id>"
}'
List all instances in your Vultr account and note the target instance's ID.
$ vultr-cli instance list
List all VPC networks in your Vultr account and note the target VPC network's ID.
$ vultr-cli vpc list
Attach the VPC network to the instance.
$ vultr-cli instance vpc attach <instanceID> --vpc-id="<vpc-id>"