Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

List only GCP resources used

Hi,
I have attempted to use the 'gcloud asset search-all-resources' but can not get what I want.
I have multiple projects with various resources used like GKE, VPC, BigTable, Load Balancer, etc. I would like to get a count of what is used. Something like below.

TypeProject# of resources used
VM Instancesproject 132
Load balancerProject 57
Load balancerProject 35
SQLProject 22
BigtableProject 31
GKE ClustersProject 12
VPC NetworkProject 22
Storage bucketsProject 58


Is there any way to to do this kind of resource usage count? Probably from a Organisational level.

Kind Regards
Darrell

1 1 2,571
1 REPLY 1

Hi @darrell_burgher ,

The following might help you get what you need:

gcloud asset search-all-resources --scope=organizations/301928500920 --page-size=500 --format='csv(assetType,project)' | sed 1d | sort | uniq -c

(derived from the example in this doc: https://cloud.google.com/asset-inventory/docs/searching-resources-samples#use_case_count_all_the_clo...)