Finding resources in GCP using gCloud
To quickly find all resources within a project or even a parent org, we can use asset manager and resource manager API in GCP.
Passing in a Project name
gcloud asset search-all-resources --scope=projects/my-proj-name --page-size=500 --format=json
Passing in a Resource Type
To look for individual resource types (all VMs in an org), use the following APIs, instead of passing in the project name, pass in the type of resource (API)
compute.googleapis.com/ Instance Compute
storage.googleapis.com/Bucket Storage
dataproc.googleapis.com/ Cluster DataProc Clusters
cloudfunctions.googleapis.com/ CloudFunction Cloud Functions
dataflow.googleapis.com/Job // for Notebook
gcloud asset search-all-resources --asset-types='compute.
Leave a Reply