Delete an external peer VPN gateway

The following procedures enable you to delete an external peer VPN gateway resource for an HA VPN gateway. This resource represents your physical or software-based gateway in Google Cloud.

To add an external peer VPN gateway resource, see Configure the peer VPN gateway.

Before removing an external peer VPN gateway resource, delete all associated VPN tunnels.

To delete an external peer VPN gateway resource, complete the following steps.

Console

  1. In the Google Cloud console, go to the VPN page.

    Go to VPN

  2. Find the row that contains the Peer gateway name that you want to delete.

  3. Under In use by VPN tunnels, click the name of the tunnel to delete.

  4. On the VPN tunnel details page, at the top of the page, click Delete.

  5. On the VPN tunnels page, wait for the tunnel to be deleted.

  6. Click the Peer VPN gateways tab.

  7. Under Peer gateway name, find the row that contains the gateway that you want to delete.

  8. In that row, to delete the gateway, click Actions, then select Delete.

  9. In the confirmation dialog box, click Delete.

  10. To confirm that the gateway has been deleted, at the top of the page, click Refresh.

gcloud

In the following commands, replace the following:

  • PROJECT_ID: the ID of your project
  • EXTERNAL_GATEWAY_NAME: the name of your external peer VPN gateway

To delete the gateway, follow these steps:

  1. Identify the name of the external peer VPN gateway that you want to delete, and then use that information in later steps. To list all VPN gateways, run the following command:

    gcloud compute external-vpn-gateways list
       --project=PROJECT_ID
    
  2. Determine if the VPN gateway has any VPN tunnels that need to be deleted. To list all tunnels associated with the gateway, run the following command:

    gcloud compute vpn-gateways describe EXTERNAL_GATEWAY_NAME \
       --project=PROJECT_ID \
       --format='flattened(tunnels)'
    
  3. Delete each existing tunnel.

  4. Delete the external peer VPN gateway.

    gcloud compute external-vpn-gateways delete EXTERNAL_GATEWAY_NAME \
       --project=PROJECT_ID
    

API

To delete tunnels first, make a DELETE request by using the vpnTunnels.delete method:

DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/vpnTunnels/TUNNEL_NAME

Make a DELETE request by using the externalVpnGateways.delete method:

DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/externalVpnGateways/EXTERNAL_GATEWAY_NAME

What's next