如何以编程方式获得本月的Google Cloud费用? [英] How do I get Google Cloud costs for this month programmatically?
问题描述
我当前的Google Cloud计费信息中心向我显示了我所有Google服务(存储,BigQuery等)的本月费用.
My current Google Cloud billing dashboard shows me the charges for this month, for all my Google Services: Storage, BigQuery, etc.
如何以编程方式获取此信息? Cloud Billing API仅提供了我的账单详细信息,但这不是我想要的.
How do I get this information programmatically? The Cloud Billing API only gives me billing details, but that is not what I want.
我还尝试查看Google存储空间中定期更新的结算文件,但该文件仅包含2天前的信息.
I also tried looking into Google Storage for the billing file they periodically update, but it contains information for 2 days ago only.
我该怎么办?
推荐答案
如果在结算"标签中启用结算导出",则每天都会将新的JSON或CSV文件导出到Google Cloud Storage中.它将包含当天的使用情况和费用信息.自从项目开始以来,我就在那里保存文件.
If you enable 'Billing Export' in the 'Billing' tab, a new JSON or CSV file will be exported everyday into Google Cloud Storage. It will have that days' usage and cost information. I have files there since the beginning of my project.
这篇关于如何以编程方式获得本月的Google Cloud费用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!