How to Destroy a VPC Peering

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.


Deleting a VPC peering permanently and irreversibly destroys the connection between two VPC networks.

Delete a VPC Peering Using Automation

How to Delete a VPC Peering Using the DigitalOcean CLI
  1. Install doctl, the DigitalOcean command-line tool.

  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 peerings delete. Basic usage looks like this, but you can read the usage docs for more details:

                doctl vpcs peerings delete <peering-id> [flags]
              

    The following example deletes the VPC Peering with the ID f81d4fae-7dec-11d0-a765-00a0c91e6bf6:

                  doctl vpcs peerings delete f81d4fae-7dec-11d0-a765-00a0c91e6bf6
                
How to Delete a VPC Peering Using the DigitalOcean API
  1. Create a personal access token and save it for use with the API.

  2. Send a DELETE request to https://api.digitalocean.com/v2/vpc_peerings/{vpc_peering_id}

    cURL

    Using cURL:

                    curl -X DELETE \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
      "https://api.digitalocean.com/v2/vpc_peerings/6b5c619c-359c-44ca-87e2-47e98170c01d"
                  

Delete a VPC Peering Using the Control Panel

To destroy a VPC peering connection, click Networking in the main menu, then click the VPC tab. Click the name of one of the VPC networks in the peering to delete, then click on the Peering Connections tab. A list of active peering connections is shown.

a VPC peering connections list, showing the 'More' menu expanded, with options for 'Edit peering settings' and 'Delete Connection'

Click the More menu next to the VPC peering you want to destroy and select Delete Connection. A confirmation dialog pops up.

the Delete Peering Connection confirmation dialog, with a text box to enter the name of the peering connection, and buttons to 'Cancel' and 'Delete Peering Connection'

Enter the name of the peering connection in the text box, then click Delete Peering Connection to confirm.