API for getting daily costs related to GCP

1.4k Views Asked by At

Is there any API(preferably python) that can be used to get the resources' usage cost report in GCP? Billing APIs don't seem to return the costs of resources being used.

1

There are 1 best solutions below

0
Toussah On

You can export you cloud billing data to BigQuery: https://cloud.google.com/billing/docs/how-to/export-data-bigquery https://cloud.google.com/billing/docs/how-to/export-data-bigquery-setup

You select the dataset where the cost metadata goes, once in BigQuery, it's fairly easy to query, which you can do with the python BigQuery client API, it also makes sure you keep a historic in case you change billing provider, of course it'll incur storage cost which will vary based on your usage.