Listing and deleting Cloud Routers

List all the Cloud Routers in your project or delete the ones that you don't use.

Listing routers

To list all the Cloud Routers in a project, complete the following steps:

Console


Go to the Cloud Router page in the Google Cloud Console.

Cloud Router list

gcloud


gcloud compute --project [PROJECT_ID] routers list
NAME      REGION     NETWORK
my-router asia-east1 my-network

To restrict the list to only one region, specify --region.

API

To list all the Cloud Routers in a project, use the routers.aggregatedList method.

GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/aggregated/routers

Replace PROJECT_ID with the ID of the project for which you want to list routers.

To list only the Cloud Routers in a specific region, use the routers.list method.

GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers

Replace the following values:

  • PROJECT_ID: the ID of the project for which you want to list routers
  • REGION: the region for which you want to list routers

Deleting routers

Before you can delete a router, check that it's not being used by another resource, such as a Cloud VPN tunnel or a VLAN attachment. You must delete the associated resource before you can delete the router.

You're not required to remove BGP sessions before deleting the router.

Console


  1. Go to the Cloud Router list.
  2. Select the checkbox next to the Cloud Router that you want to delete.
  3. Click Delete.

gcloud


gcloud compute --project [PROJECT_ID] routers delete my-router \
    --region asia-east1
Deleted [https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/regions/asia-east1/routers/my-router].

API

To delete a Cloud Router, use the routers.delete method.

DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME

Replace the following values:

  • PROJECT_ID: the project that contains the Cloud Router that you want to delete
  • REGION: the region where the Cloud Router is located
  • ROUTER_NAME: the name of the Cloud Router