Where’s my stuff on GCP?

Nick Brandaleone
Google Cloud - Community
2 min readFeb 28, 2022

--

Since every resource created in the Cloud costs $, it is a common issue tracking down resources in your account. I recall working in AWS this was particularly challenging, due to the regional aspect of most of the services. Not only did I have to issue the proper command, but I had to loop through all the different regions as well. Often, the best way was to simply look at your bill, and track things down from there.

Cloud Asset Inventory overview

In 2018 GCP released a feature called Cloud Asset Inventory. It allows one to search for all your resources globally. This is yet another reason why I think that GCP focuses on ease of use and developer productivity more so than other Cloud Provider (i.e. I am talking about you AWS and Azure).

Here is an example of tracking down some of my storage buckets using the gcloud CLI:

$ gcloud asset search-all-resources --asset-types='storage.googleapis.com/Bucket' --limit 2
---
assetType: storage.googleapis.com/Bucket
createTime: '2022-02-16T18:03:23Z'
displayName: gcf-v2-sources-659824402950-us-central1
location: us-central1
name: //storage.googleapis.com/gcf-v2-sources-659824402950-us-central1
parentAssetType: cloudresourcemanager.googleapis.com/Project
parentFullResourceName: //cloudresourcemanager.googleapis.com/projects/nicks-playground-3141
project: projects/659824402950
updateTime: '2022-02-16T18:03:23Z'
---
assetType: storage.googleapis.com/Bucket
createTime: '2022-02-14T19:16:55Z'
displayName: artifacts.nicks-playground-3141.appspot.com
location: us
name: //storage.googleapis.com/artifacts.nicks-playground-3141.appspot.com
parentAssetType: cloudresourcemanager.googleapis.com/Project
parentFullResourceName: //cloudresourcemanager.googleapis.com/projects/nicks-playground-3141
project: projects/659824402950
updateTime: '2022-02-14T19:16:55Z'

You can also just look for everything. However, the output can be voluminous for a large project, which is why it is recommended to export the results into a storage bucket, or into Big Query for easy searching.

Still, it is easy to do:

$ gcloud asset search-all-resources

Check out the documentation on Cloud Asset Inventory, or the gcloud commands I used in the article. Here is a video going over the product in more detail than this brief overview, including how to use the Console to visually see where your resources are located.

Good luck keeping track and deleting old, unnecessary resources!

--

--

Nick Brandaleone
Google Cloud - Community

I work for Google as a AppMod Customer Engineer, focusing on kubernetes and serverless products. However, any views expressed on this blog are solely mine.