Deleting a Cloud VPN gateway

The following procedures enable you to delete a Classic VPN or an HA VPN gateway. HA VPN uses the vpn-gateways command option and Classic VPN uses the target-vpn-gateways command option.

Required permissions

Project owners, editors, and IAM members with the Network Admin role can delete Cloud VPN gateways.

Deleting an HA VPN gateway

To delete an existing HA VPN gateway, do the following:

gcloud


In the following commands, replace [PROJECT_ID] with the ID of your project.

  1. Identify the name and region of the VPN gateway you need to remove. You can list all VPN gateways with the following command. Once you identify the VPN gateway, replace [NAME] and [REGION] with its name and region in the following steps.

     gcloud compute vpn-gateways list --project [PROJECT_ID]
    
  2. Determine if the VPN gateway has any VPN tunnels that need to be removed. Use the following command to list all tunnels associated with it:

     gcloud compute vpn-gateways describe [NAME] \
       --region [REGION] \
       --project [PROJECT_ID] \
       --format='flattened(tunnels)'
    
  3. Delete each existing tunnel.

  4. Delete the VPN gateway.

     gcloud compute vpn-gateways delete [NAME] \
       --region [REGION] \
       --project [PROJECT_ID]
    

Deleting a Classic VPN gateway

To delete an existing Classic VPN gateway, do the following:

Console


  1. Go to the VPN gateway page.
  2. Click the name of the VPN gateway you need to remove.
  3. On the VPN gateway details page, in the Tunnels section, delete all existing tunnels.
  4. At the top of the same page, click Delete.
  5. Click Delete again when asked to confirm.

gcloud


In the following commands, replace [PROJECT_ID] with the ID of your project.

  1. Identify the name and region of the VPN gateway you need to remove. You can list all VPN gateways with the following command. Once you identify the VPN gateway, replace [NAME] and [REGION] with its name and region in the following steps.

     gcloud compute target-vpn-gateways list --project [PROJECT_ID]
    
  2. Determine if the VPN gateway has any VPN tunnels that need to be removed. Use the following command to list all tunnels associated with it:

     gcloud compute target-vpn-gateways describe [NAME] \
       --region [REGION] \
       --project [PROJECT_ID] \
       --format='flattened(tunnels)'
    
  3. Delete each existing tunnel.

  4. Determine the names of the three forwarding rules associated with the target VPN gateway.

     gcloud compute target-vpn-gateways describe [NAME] \
       --region [REGION] \
       --project [PROJECT_ID] \
       --format='flattened(forwardingRules)'
    
  5. Delete the forwarding rules. Repeat this command, replacing [FR_NAME] with the name of each forwarding rule:

     gcloud compute forwarding-rules delete [FR_NAME] \
       --region [REGION] \
       --project [PROJECT_ID]
    
  6. Delete the target VPN gateway.

     gcloud compute target-vpn-gateways delete [NAME] \
       --region [REGION] \
       --project [PROJECT_ID]
    

After deleting a VPN gateway, consider doing the following:

What's next

Var denne siden nyttig? Si fra hva du synes:

Send tilbakemelding om ...