AWS - 如何以编程方式获取账单月度预测

AWS - How to obtain Billing Monthly Forecast programmatically

我只是想知道目前是否可以使用 SDK 或 API 获取每月计费预测金额。

AWS docs it doesn't seem possible. Although I haven't delved into the Cost ExplorerAPI太多了,不知道还有没有人能拿到这个数据点?

AWS Billing and Cost Management API 中有一个 GetCostAndUsage 方法,其中 return 是成本和使用指标。此方法还接受 TimePeriod 其中 return 根据给定时间范围的结果。虽然我没有测试它,但你可以尝试在其中传递未来的日期,也许它会 return 预测结果。试一试

{
  "TimePeriod": {
    "Start":"2018-06-01",
    "End": "2018-06-30"
  },
  "Granularity": "MONTHLY",
  "Filter": {      
    "Dimensions": {
      "Key": "SERVICE",
      "Values": [
        "Amazon Simple Storage Service"
      ]
    }
  },
  "GroupBy":[
    {
      "Type":"DIMENSION",
      "Key":"SERVICE"
    },
    {
      "Type":"TAG",
      "Key":"Environment"
    }
  ],
   "Metrics":["BlendedCost", "UnblendedCost", "UsageQuantity"]
}