How to Create a VPC

Last verified 22 Jun 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.

Create a VPC Network Using the CLI

The VPC creation command requires you to provide a datacenter region for the --region flag. Use doctl compute region list command to retrieve a list of available datacenter regions.

How to Create a VPC Network Using the DigitalOcean CLI
  1. Install doctl, the official DigitalOcean CLI.
  2. Create a personal access token and save it for use with doctl.
  3. Use the token to grant doctl access to your DigitalOcean account.
    doctl auth init
  4. Finally, run doctl vpcs create. Basic usage looks like this, but you can read the usage docs for more details:
    doctl vpcs create [flags]

The following example creates a VPC network named example-vpc in the nyc1 region:

doctl vpcs create --name example-vpc --region nyc1

Create a VPC Network Using the API

The VPC creation call requires you to provide a datacenter region for the region field. Use the /v2/regions endpoint to retrieve a list of available datacenter regions.

How to Create a VPC Network Using the DigitalOcean API

Create a personal access token and save it for use with the API.

cURL

Send a POST request to https://api.digitalocean.com/v2/vpcs.

Using cURL:

curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"name":"my-new-vpc", "region":"nyc1", "ip_range": "10.10.10.0/24"}' \
  "https://api.digitalocean.com/v2/vpcs"

Go

Using Godo, the official DigitalOcean API client for Go:

import (
    "context"
    "os"

    "github.com/digitalocean/godo"
)

func main() {
    token := os.Getenv("DIGITALOCEAN_TOKEN")

    client := godo.NewFromToken(token)
    ctx := context.TODO()

    createRequest := &godo.VPCCreateRequest{
     Name:       "my-new-vpc",
     RegionSlug: "nyc1",
     IPRange:    "10.10.10.0/24",
    }

    vpc, _, err := client.VPCs.Create(ctx, createRequest)
}

Python

Using PyDo, the official DigitalOcean API client for Python:

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "name": "env.prod-vpc",
  "description": "VPC for production environment",
  "region": "nyc1",
  "ip_range": "10.10.10.0/24"
}

resp = client.vpcs.create(body=req)

Create a VPC Network Using the Control Panel

To create a VPC network, click Networking in the main menu, then click VPC. On the VPC Networks page, click Create VPC Network.

VPC Networks page showing existing VPC networks grouped by datacenter region, with columns for IP range, connections, NAT gateways, and resources.

On the Create VPC Network page, configure the following sections:

  1. Choose a datacenter region: select the datacenter region from the Choose a datacenter region drop-down. Resources you add to the VPC network must be in the same region.

  2. Configure the Private IP Range: choose how the IP range is generated.

    • Generate an IP range for me (recommended): saves time calculating IP ranges and prevents overlap with your other networks.
    • Configure my own IP range: lets you specify the subnet IP prefix and size. See Planning Your Network Size for guidance. The IP range cannot overlap with the ranges of other networks in your account, and the Control Panel prevents overlapping ranges.
  3. Choose a name and description: enter a name in the Name field. The form pre-fills a default name based on the region (for example, nyc3-vpc-01). Optionally add text in the Description field.

Click Create VPC Network.

Once the VPC network is created, you can create new resources in the network. VPC networks currently support Droplets, managed databases, load balancers, and Kubernetes clusters.

You can also migrate existing managed databases and Droplets to a VPC network, but currently cannot migrate Kubernetes clusters and load balancers.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.