google-cloud-billing

How can I get the equivalent billing data without using the BigQuery billing report in Google Cloud?


There is a feature in Google Cloud Platform that allows reporting resource usages. This is cool because it supports two things I will make use of:

And, by doing this, I can make use of plain SQL queries over the dumped data (which goes to BigQuery) to report what I need.

But is there a way I can do this without using BigQuery? Like doing a real-time query? Concretely, solve this requirement:

  1. Take a time range.
  2. Take the service type I need (e.g. stating "Google Cloud Run Deployment").
  3. Take a custom label (let's say I have a label named "customer" and its value "my-mother").
  4. Ask the usage amounts and corresponding pricing values for each resource of that service type and labels criteria.
  5. Weight-summarize the end value (the value would be expressed in US dollars).

Is there a way I can do that with some direct GCP Billing API and not by using SQL on BigQuery dumps? (this means: An existing function or class in the billing library or somewhere else - not sure but one that allows me to ask this query).


Solution

  • You can export billing data to Pub/Sub, Cloud Storage, or BigQuery. The Billing APIs do not provide query abilities.

    Is there a way I can do that with some direct GCP Billing API and not by using SQL on BigQuery dumps?

    If you want those features without using BigQuery then you will need to create an export sink and load the data into a system that supports queries.