Hi everyone,
I’m trying to figure out the best way to programmatically access my GCP project’s current billing/cost data. I’ve looked into a few different options, but I’m still a bit confused about what’s possible and what isn’t.
What I’ve tried so far:
-
Looked for a public API (similar to AWS Cost Explorer or Azure Consumption APIs), but it seems Google Cloud doesn’t provide a direct endpoint to return cost or usage.
-
Tried the Cloud Billing Budgets API, but that only gives me “budget vs. spend,” not detailed line-item cost data.
-
Used the Cloud Billing Catalog API, but that only provides SKU pricing, not actual usage or charges.
-
Finally, I set up BigQuery export for billing data. I was able to create a dataset and link billing export to it. From there I can query cost by project, SKU, and service. This seems to be the recommended approach, but it feels heavier compared to AWS/Azure where a simple API call gives you the numbers.
What I’m stuck on / would appreciate guidance:
-
Is BigQuery export truly the only way to get detailed billing data programmatically in GCP?
-
Is there any way to fetch a month-to-date cost per project (similar to AWS Cost Explorer’s
GetCostAndUsage) without relying on BigQuery?
If anyone can clarify the best approach here (or confirm that BigQuery is the only option), I’d really appreciate it.
Thanks in advance!