Vultr Virtual Private Cloud (VPC 2.0) networks offer the flexibility of choosing your own IP range and subnets to secure internal network communications. Attaching a virtual isolated VPC 2.0 network to a managed database allows you to create hybrid connections that enforce traffic rules to your applications. VPCs protect database resources from the public internet.
Follow this guide to manage VPC 2.0 Networks for Vultr Managed Databases for Caching with Vultr Customer Portal, API, and CLI.
Navigate to Products and select Databases.
Click the target database instance.
Navigate to VPC Network under Overview. Select a VPC network from the list and click Update.
List all the database instances by sending a GET
request to the List Managed Databases endpoint and note the database ID. For example, 43b4c774-5dff-4ac0-a01f-78a23c2205b5
.
$ curl "https://api.vultr.com/v2/databases" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
List all the VPC 2.0 networks by sending a GET
request to the List VPC 2.0 networks endpoint and note the VPC 2.0 ID. For example, 778dd77c-a581-43a8-94e6-75b6ceb4354a
.
$ curl "https://api.vultr.com/v2/vpc2" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a PUT
request to the Update Managed Database endpoint endpoint to attach the VPC 2.0 network to the database by specifying the database ID and the VPC 2.0 ID.
$ curl "https://api.vultr.com/v2/databases/database_id" \
-X PUT \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"vpc_id" : "vpc2_network_id"
}'
Detach a VPC 2.0 network from the database by sending a PUT
request to the Update Managed Database endpoint and specify a database ID and an empty VPC 2.0 ID.
$ curl "https://api.vultr.com/v2/databases/database_id" \
-X PUT \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"vpc_id" : ""
}'
Visit the Update Managed Database endpoint to view additional attributes to add to your request.
List all database instances and note the database ID. For instance, d6ac2a3c-92ea-43ef-8185-71a23e58ad8c
.
$ vultr-cli database list --summarize
List all VPC 2.0 networks and note the VPC 2.0 ID. For instance, 778dd77c-a581-43a8-94e6-75b6ceb4354a
.
$ vultr-cli vpc2 list
Attach the VPC 2.0 network by specifying the database ID and the VPC 2.0 ID.
$ vultr-cli database update database_id \
--vpc-id vpc2_id
Run vultr-cli database update --help
to view all options.