Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

More Detailed Billing Information of GCS Buckets

I have multiple GKE clusters with logically separated K8s objects using namespaces, each namespace has GCS bucket attached to it (Statefulset)

I wanted to know billing information about each namespace and what each namespace costs for resources usage.

I found very useful feature called "GKE Metering" and yea it showed up some useful information about CPU and Memory billing info for each namespace by gathering billing information and import it into BigQuery, then I can visualize the results using Google Data Studio for example.

The Question Is:

  1. How can I get billing information of each GCS bucket which attached to each namespace to be visualised?
  2. How to get billing information for each namespace usage of Filestore Instance?
like image 987
Ahmed Khaled Avatar asked Jan 22 '26 19:01

Ahmed Khaled


2 Answers

For that, you need to add a label on your GCS bucket

Then to export the billing to BigQuery

And to get the data like that in BigQuery

SELECT * 
FROM `project.dataset.exportBillingTable` 
WHERE "<Your Label Key>" IN UNNEST(labels.key)

You can perform "group by", "sum", filter on the label key or the label value,...

like image 178
guillaume blaquiere Avatar answered Jan 26 '26 01:01

guillaume blaquiere


This is now available without the labeling step! The update was released in February 13, 2024

View granular cost data from Cloud Storage usage in Cloud Billing exports to BigQuery

You can now view granular Cloud Storage bucket-level cost data in the Cloud Billing Detailed cost export. Use the resource.global_name field in the export to view and filter your detailed Cloud Storage bucket usage.

like image 30
user3380086 Avatar answered Jan 26 '26 00:01

user3380086



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!