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.

After you delete an HA VPN gateway, any peer gateway resources that you have created still exist.

Deleting an HA VPN gateway

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

console


  1. Go to the VPN page in the Google Cloud Platform Console.
    Go to the VPN page
  2. Find the row containing the Gateway name you want to delete.
  3. Click the Gateway name.
  4. On the Google VPN gateway details screen, under VPN tunnels, check the box for the tunnels you want to delete.
  5. Click the Delete button.
  6. Click Delete in the confirmation dialog box.
  7. Click the Delete button at the top of the screen to delete the gateway.
  8. Click Delete in the confirmation dialog box.

gcloud


In the following commands, replace project-id with the ID of your project.

  1. Identify that the name and region of the VPN gateway that you want to delete. 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
    

api

To delete tunnels first, make a DELETE request with the vpnTunnels.delete method.

  DELETE https://www.googleapis.com/compute/v1/projects/project-id/regions/region/vpnTunnels/tunnel-name

Make a DELETE request with the vpnGateways.delete method.

  DELETE https://www.googleapis.com/compute/v1/projects/project-id/regions/region/vpnGateways/gateway-name

Deleting a Classic VPN gateway

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

Console


  1. Go to the VPN page in the Google Cloud Platform Console.
    Go to the VPN page
  2. Find the row containing the Gateway name you want to delete.
  3. Click on the Gateway name.
  4. On the Google VPN gateway details screen, under VPN tunnels, check the box for the tunnels you want to delete.
  5. Click the Delete button.
  6. Click Delete in the confirmation dialog box.
  7. Click the Delete button at the top of the screen to delete the gateway.
  8. Click Delete in the confirmation dialog box.

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
    

api

To delete tunnels first, make a DELETE request with the vpnTunnels.delete method.

  DELETE https://www.googleapis.com/compute/v1/projects/project-id/regions/region/vpnTunnels/tunnel-name

Make a DELETE request with the targetVpnGateways.delete method.

  DELETE https://www.googleapis.com/compute/v1/projects/project-id/regions/region/targetVpnGateways/gateway-name

After deleting a VPN gateway, consider doing the following:

What's next

Var denne siden nyttig? Si fra hva du synes:

Send tilbakemelding om ...