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.
Type | Project | # of resources used |
VM Instances | project 1 | 32 |
Load balancer | Project 5 | 7 |
Load balancer | Project 3 | 5 |
SQL | Project 2 | 2 |
Bigtable | Project 3 | 1 |
GKE Clusters | Project 1 | 2 |
VPC Network | Project 2 | 2 |
Storage buckets | Project 5 | 8 |
Is there any way to to do this kind of resource usage count? Probably from a Organisational level.
Kind Regards
Darrell
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...)