Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Ver seus recursos
Este documento mostra como visualizar seus recursos usando o Inventário de recursos do Cloud e a
Google Cloud CLI no Cloud Shell.
Antes de começar
Antes de usar o Inventário de recursos do Cloud, é preciso ativar a API Cloud Asset Inventory e configurar
permissões.
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Substitua PROJECT_ID pelo ID do projeto de que você quer listar os recursos.
No exemplo de código anterior, um tipo de recurso de
compute.googleapis.com/Instance é usado para listar apenas
instâncias de VM do Compute Engine. Para conferir todos os tipos de recursos, consulte
Tipos de recursos.
Um tipo de conteúdo resource também foi definido. Isso especifica que os metadados resource também precisam ser retornados na resposta. Se nenhum tipo de conteúdo for definido, apenas informações básicas sobre cada recurso serão retornadas, como o nome, a última atualização e o projeto em que ele está.
Limpar
Para evitar cobranças na sua conta do Google Cloud pelos
recursos usados nesta página, siga estas etapas.
No Google Cloud console, acesse a página Instâncias de VM:
[[["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 2025-08-18 UTC."],[[["\u003cp\u003eThis guide demonstrates how to use Cloud Asset Inventory and the Google Cloud CLI in Cloud Shell to view your assets within a Google Cloud project.\u003c/p\u003e\n"],["\u003cp\u003eBefore utilizing Cloud Asset Inventory, you must enable the Cloud Asset Inventory API and assign the Cloud Asset Owner role (\u003ccode\u003eroles/cloudasset.owner\u003c/code\u003e) to your user.\u003c/p\u003e\n"],["\u003cp\u003eYou can create a Compute Engine VM instance to practice viewing assets, then list all VM instances in your project using the \u003ccode\u003egcloud asset list\u003c/code\u003e command in Cloud Shell.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egcloud asset list\u003c/code\u003e command allows filtering by asset types, such as \u003ccode\u003ecompute.googleapis.com/Instance\u003c/code\u003e for VM instances, and you can specify the \u003ccode\u003eresource\u003c/code\u003e content type to include detailed metadata.\u003c/p\u003e\n"],["\u003cp\u003eThis document includes cleanup instructions to avoid incurring charges, through deleting your created VM instance.\u003c/p\u003e\n"]]],[],null,["# View your assets\n================\n\nThis document shows you how to view your assets using Cloud Asset Inventory and the\nGoogle Cloud CLI in Cloud Shell.\n\nBefore you begin\n----------------\n\nBefore you can use Cloud Asset Inventory, you need to enable the Cloud Asset Inventory API and set up\npermissions.\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n\n\n Enable the Cloud Asset Inventory API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=cloudasset.googleapis.com&redirect=https://console.cloud.google.com)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n\n\n Enable the Cloud Asset Inventory API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=cloudasset.googleapis.com&redirect=https://console.cloud.google.com)\n\n1. [Grant the following role to your user:](/iam/docs/granting-changing-revoking-access#single-role) Cloud Asset Owner (`roles/cloudasset.owner`).\n\nView your assets\n----------------\n\nIn a project of your choice, create a Compute Engine VM instance so that\nyou can view it in Cloud Asset Inventory:\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n\n \u003cbr /\u003e\n\n2. Click **Create instance**.\n\n3. Enter a name for the instance.\n\n4. Click **Create**.\n\nList all the VM instances in your project:\n\n1. In the Google Cloud console, click\n terminal **Activate Cloud Shell**.\n\n2. In Cloud Shell, run the following command:\n\n gcloud asset list \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n --asset-types=compute.googleapis.com/Instance \\\n --content-type=resource\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the ID of the project whose\n assets you want to list.\n\n In the previous code sample, an asset type of\n `compute.googleapis.com/Instance` is used to only list\n Compute Engine VM instances. To view all asset types, see\n [Asset types](/asset-inventory/docs/asset-types).\n\n A content type of `resource` has also been set. This specifies that\n `resource` metadata should also be returned in the response. If no\n content type is set, then only basic information about each asset is\n returned, such as the asset name, the last time it was updated, and what\n project it's in.\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n\n \u003cbr /\u003e\n\n2. In the same row as the name of the VM instance you created, click\n more_vert **More actions**.\n\n3. Click **Delete**, and then confirm the deletion.\n\nWhat's next\n-----------\n\n- To explore more options related to viewing your assets, see [List assets](/asset-inventory/docs/list-assets)."]]