How to Manage VPC Subnetspublic

Last verified 28 Sep 2026

A Virtual Private Cloud (VPC) is a private network interface for collections of DigitalOcean resources. VPC networks are inaccessible from the public internet and other VPC networks, and traffic on them doesn’t count against bandwidth usage. You can link VPC networks to each other using VPC peering connections.

Note

VPC subnets and routes are in public preview and available to all customers without opting in from the Feature Preview page. During the public preview, you manage subnets and routes with the DigitalOcean API. The Control Panel does not support them yet.

VPC subnets add IP address ranges to a VPC network as separate, named segments. During the public preview, you manage subnets using the DigitalOcean API.

Prerequisites

Create a Subnet

To create a subnet, send a POST request to the /v2/vpcs/<vpc-id>/subnets endpoint, replacing <vpc-id> with your VPC’s ID. The name field is required. The ip_range field must be an RFC 1918 CIDR with a prefix length between /16 and /28 that does not overlap with any other subnet on your team:

curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{
    "name": "app-tier-subnet",
    "ip_range": "192.168.11.0/24"
}' \
  "https://api.digitalocean.com/v2/vpcs/<vpc-id>/subnets"

The response returns the new subnet, including its ID, URN, region, and type:

Output
{
  "vpc_subnet": {
    "id": "4de7ac8b-495b-4884-9a69-1050c6793cd6",
    "urn": "do:vpc_subnet:4de7ac8b-495b-4884-9a69-1050c6793cd6",
    "name": "app-tier-subnet",
    "region": "nyc3",
    "ip_range": "192.168.11.0/24",
    "default": false,
    "type": "REGULAR",
    "created_at": "2026-07-30T12:00:00Z"
  }
}

List Subnets

To list all subnets in a VPC, send a GET request to the /v2/vpcs/<vpc-id>/subnets endpoint:

curl -X GET \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/vpcs/<vpc-id>/subnets"

The response is paginated and includes each subnet’s ID, name, IP range, and type.

To retrieve a single subnet, send a GET request to the /v2/vpcs/<vpc-id>/subnets/<subnet-id> endpoint with the subnet’s ID.

Rename a Subnet

To rename a subnet, send a PATCH request to the /v2/vpcs/<vpc-id>/subnets/<subnet-id> endpoint with the new name. You cannot change a subnet’s IP range after creation:

curl -X PATCH \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{
    "name": "web-tier-subnet"
}' \
  "https://api.digitalocean.com/v2/vpcs/<vpc-id>/subnets/<subnet-id>"

How Resources Join a Subnet

A resource joins a subnet when you create it, so there is no separate step to assign an existing resource to a subnet. This is why the members endpoint is read-only.

To place a resource in a specific subnet, pass the subnet’s UUID when you create the resource and include the VPC’s ID:

  • Droplets: set subnet_uuid (which requires vpc_uuid) in the create Droplet API request.
  • DigitalOcean Kubernetes (DOKS): set worker_subnet_uuid (which requires vpc_uuid) in the create cluster API request.
  • Load Balancers and NAT gateways: set the subnet’s UUID in the create API request.

If you do not specify a subnet, the resource is placed in the VPC’s default subnet. You cannot move a resource to a different subnet after you create it.

During the public preview, you can choose a subnet when you create a Droplet, DOKS cluster, Load Balancer, or NAT gateway.

List Subnet Members

To list the resources attached to a subnet, send a GET request to the /v2/vpcs/<vpc-id>/subnets/<subnet-id>/members endpoint. Use the optional resource_type query parameter to filter members by type: droplet, loadbalancer, or kubernetes:

curl -X GET \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/vpcs/<vpc-id>/subnets/<subnet-id>/members?resource_type=droplet"

The response lists each member’s URN, name, and creation time.

Delete a Subnet

To delete a subnet, send a DELETE request to the /v2/vpcs/<vpc-id>/subnets/<subnet-id> endpoint:

curl -X DELETE \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/vpcs/<vpc-id>/subnets/<subnet-id>"

A successful request returns a 204 status code with no response body.

Next Steps

To control how traffic from a subnet reaches its destination, see How to Manage Routes.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.