google-cloud-billing

How to get billing information programmatically from Google Cloud Platform?

拥有回忆 提交于 2019-12-25 18:37:12
问题 I want write utility which fetches billing information for my project dynamically but I am not able to find any specific API from GCP to do the same. I tried a couple of APIs like getBillingInfo but these APIs just give information about billing account, not the pricing. They have the mechanism to export billing data to file but I want to do it programmatically. Is there any API to do the same? 回答1: There are two ways to get the billing data from Google Cloud Platform: Export Billing Data to

How do I get Google Cloud costs for this month programmatically?

时光毁灭记忆、已成空白 提交于 2019-12-12 01:39:39
问题 My current Google Cloud billing dashboard shows me the charges for this month, for all my Google Services: Storage, BigQuery, etc. How do I get this information programmatically? The Cloud Billing API only gives me billing details, but that is not what I want. I also tried looking into Google Storage for the billing file they periodically update, but it contains information for 2 days ago only. What should I do? 回答1: If you enable 'Billing Export' in the 'Billing' tab, a new JSON or CSV file