How to Manage VPC Networks for Vultr Managed Database for Valkey
-
by Blog Admin
- 8
How to Manage VPC Networks for Vultr Managed Database for Valkey
A guide for creating and managing private network connections between your Vultr Managed Database for Valkey and other resources using Virtual Private Cloud (VPC) networks.
Vultr Virtual Private Cloud (VPC) networks offer the flexibility of choosing your own IP range and subnets to secure internal network communications. Attaching a virtual isolated VPC 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 Networks for Vultr Managed Database for Valkey with Vultr Customer Portal, API, CLI, or Terraform.
Vultr Customer Portal
- 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.
Vultr API
- 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
.console$ curl "https://api.vultr.com/v2/databases" \ -X GET \ -H "Authorization: Bearer ${VULTR_API_KEY}"
- List all the VPC networks by sending a
GET
request to the List VPC networks endpoint and note the VPC ID. For example,778dd77c-a581-43a8-94e6-75b6ceb4354a
.console$ curl "https://api.vultr.com/v2/vpcs" \ -X GET \ -H "Authorization: Bearer ${VULTR_API_KEY}"
- Send a
PUT
request to the Update Managed Database endpoint endpoint to attach the VPC network to the database by specifying the database ID and the VPC ID.console$ 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" : "vpc_network_id" }'
- Detach a VPC network from the database by sending a
PUT
request to the Update Managed Database endpoint and specify a database ID and an empty VPC ID.console$ 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.
Vultr CLI
- List all database instances and note the database ID. For instance,
d6ac2a3c-92ea-43ef-8185-71a23e58ad8c
.console$ vultr-cli database list --summarize
- List all VPC networks and note the VPC ID. For instance,
778dd77c-a581-43a8-94e6-75b6ceb4354a
.console$ vultr-cli vpc list
- Attach the VPC network by specifying the database ID and the VPC ID.
console
$ vultr-cli database update database_id \ --vpc-id <vpc_id>
Run
vultr-cli database update --help
to view all options.
Terraform
- Open your Terraform configuration for the existing Managed Database for Valkey resource.
- Attach a VPC by setting the
vpc_id
argument. To detach, setvpc_id = null
.terraformresource "vultr_database" "valkey" { # ...existing fields (database_engine, region, plan, label, etc.) vpc_id = var.vpc_id # e.g., "778dd77c-a581-43a8-94e6-75b6ceb4354a" }
terraform# Detach VPC resource "vultr_database" "valkey" { # ...existing fields vpc_id = null }
- Apply the configuration and observe the following output:
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
How to Manage VPC Networks for Vultr Managed Database for Valkey A guide for creating and managing private network connections between your Vultr Managed Database for Valkey and other resources using Virtual Private Cloud (VPC) networks. Vultr Virtual Private Cloud (VPC) networks offer the flexibility of choosing your own IP…
How to Manage VPC Networks for Vultr Managed Database for Valkey A guide for creating and managing private network connections between your Vultr Managed Database for Valkey and other resources using Virtual Private Cloud (VPC) networks. Vultr Virtual Private Cloud (VPC) networks offer the flexibility of choosing your own IP…