GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/aggregated/routers
Substitua PROJECT_ID pelo ID do projeto em que você
quer listar os Cloud Routers.
Para listar apenas os Cloud Routers em uma região específica, use o
método
routers.list.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers
Substitua:
PROJECT_ID: o ID do projeto em que você quer
listar os Cloud Routers.
REGION: a região que você quer listar os Cloud Routers.
Excluir Cloud Routers
Antes de excluir um Cloud Routers, verifique se ele não está sendo usado por outro
recurso, como um túnel do Cloud VPN ou um anexo da VLAN. Você precisa excluir
o recurso associado antes de excluir o Cloud Routers.
No entanto, não é
preciso remover as sessões do BGP antes de excluir o Cloud Routers.
Para excluir o Cloud Router, siga estas etapas.
Console
No console do Google Cloud, acesse a página do Cloud Routers.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2024-12-05 UTC."],[],[],null,["# Manage Cloud Routers\n====================\n\nThis document describes how to list, update, get status of, and delete\nCloud Router.\n\nBefore you begin\n----------------\n\n### gcloud\n\nIf you want to use the command-line examples in this guide, do the following:\n\n1. Install or update to the latest version of the [Google Cloud CLI](/compute/docs/gcloud-compute).\n2. Set a [default region and\n zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n### API\n\nIf you want to use the API examples in this guide, set up\n[API access](/compute/docs/api/prereqs).\n\nList Cloud Routers\n------------------\n\nTo list all the Cloud Routers in a project, follow these steps. \n\n### Console\n\n1. In the Google Cloud console, go to the **Cloud Routers** page.\n\n [Go to Cloud Routers](https://console.cloud.google.com/hybrid/routers/list)\n2. On the **Cloud Routers** page, view a list of your\n Cloud Routers.\n\n### gcloud\n\nRun the `list` command. To restrict the list to only one region, specify\n`--filter=\"region:(\u003cvar\u003eREGION\u003c/var\u003e)`. \n\n```\n gcloud compute routers list \\\n --project=PROJECT_ID \\\n [--filter=\"region:(REGION)]\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project for which you want to list Cloud Routers\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region for which you want to list routers---for example, `asia-east1`\n\nThe output is similar to the following: \n\n```\n NAME REGION NETWORK\n my-router asia-east1 my-network\n```\n\n### API\n\nUse the\n[`routers.aggregatedList`](/compute/docs/reference/rest/v1/routers/aggregatedList)\nmethod: \n\n```\nGET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/aggregated/routers\n```\n\nReplace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the ID of the project for which you\nwant to list Cloud Routers.\n\nTo list only the Cloud Routers in a specific region, use the\n[`routers.list`](/compute/docs/reference/rest/v1/routers/list)\nmethod: \n\n```\nGET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project for which you want to list Cloud Routers\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region for which you want to list Cloud Routers\n\nUpdate Cloud Routers\n--------------------\n\nIf a Cloud Router is associated with an\n[NCC Gateway](/network-connectivity/docs/network-connectivity-center/concepts/ncc-gateway-overview),\nkeep the following in mind:\n\n- You can't update the `ncc_gateway` field.\n- The `patch` or `update` methods don't accept the `network` field as part of\n the request body.\n\n### gcloud\n\nUse the [`gcloud compute routers update` command](/sdk/gcloud/reference/compute/routers/update): \n\n```\ngcloud compute routers update ROUTER_NAME\n --region=REGION\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eROUTER_NAME\u003c/var\u003e: the name of the Cloud Router that you want to update\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region where the Cloud Router resides\n\n### API\n\nUse the\n[`routers.update`](/compute/docs/reference/rest/v1/routers/update)\nmethod: \n\n```\nPATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project for which you want to list Cloud Routers\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region where the Cloud Router resides\n- \u003cvar translate=\"no\"\u003eROUTER_NAME\u003c/var\u003e: the name of the Cloud Router that you want to update\n\nGet Cloud Router status\n-----------------------\n\n### gcloud\n\nUse the\n[`gcloud compute routers get-status` command](/sdk/gcloud/reference/compute/routers/get-status). \n\n```\ngcloud compute routers get-status ROUTER_NAME \\\n --project=PROJECT_ID \\\n --region=REGION\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eROUTER_NAME\u003c/var\u003e: the name of the Cloud Router that you want to get the status of\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID that the Cloud Router belongs to\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region where the Cloud Router resides\n\n### API\n\nUse the [`routers.getRouterStatus`](/compute/docs/reference/rest/v1/routers/getRouterStatus)\nmethod with an empty request body: \n\n```\nGET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME/getRouterStatus\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID that the Cloud Router belongs to\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region where the Cloud Router resides\n- \u003cvar translate=\"no\"\u003eROUTER_NAME\u003c/var\u003e: the name of the Cloud Router that you want to get the status of\n\nDelete Cloud Routers\n--------------------\n\nBefore you delete a Cloud Router, check that it isn't being used by\nanother resource, such as a Cloud VPN tunnel or a VLAN attachment. You must\ndelete the associated resource before you can delete the Cloud Router.\nHowever, you aren't required to remove BGP sessions before you delete the\nCloud Router.\n| **Warning:** Deleting a Cloud Router deletes any Cloud NAT gateways that are associated with the Cloud Router.\n\nTo delete the Cloud Router, follow these steps. \n\n### Console\n\n1. In the Google Cloud console, go to the **Cloud Routers** page.\n\n [Go to Cloud Routers](https://console.cloud.google.com/hybrid/routers/list)\n2. Select the checkbox next to the Cloud Router that you want to\n delete.\n\n3. Click delete**Delete**.\n\n### gcloud\n\nRun the `delete` command. Specify the name and location of the\nCloud Router that you want to delete. \n\n```\ngcloud compute routers delete ROUTER_NAME \\\n --project=PROJECT_ID \\\n --region=REGION\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eROUTER_NAME\u003c/var\u003e: the name of the Cloud Router that\n you want to delete\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project that contains the\n Cloud Router that you want to delete\n\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region in which the Cloud Router is\n located\n\nThe output is similar to the following: \n\n```\nDeleted [https://www.googleapis.com/compute/v1/projects/PROJECT_ID/regions/asia-east1/routers/ROUTER_NAME].\n```\n\n### API\n\nUse the\n[`routers.delete`](/compute/docs/reference/rest/v1/routers/delete)\nmethod: \n\n```\nDELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project that contains the Cloud Router that you want to delete\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region where the Cloud Router is located\n- \u003cvar translate=\"no\"\u003eROUTER_NAME\u003c/var\u003e: the name of the Cloud Router\n\nWhat's next\n-----------\n\n- To view the configuration of a Cloud Router, its BGP sessions, and the routes that Cloud Router is advertising, see [View router\n details](/network-connectivity/docs/router/how-to/viewing-router-details).\n- To troubleshoot issues when using Cloud Router, see [Troubleshooting](/network-connectivity/docs/router/resources/troubleshooting)."]]