无法连接到 Cost Explorer 中的端点 URL

Could not connect to the endpoint URL in Cost Explorer

我正在尝试使用 CostExplorer 估算费用,按 TagName 过滤。

time_period = {'Start':'2017-12-18', 'End':'2017-12-19'}
filters = {
  "And":
    [{
      "Tags": {
        "Key": "TagName",
        "Values": ["Test1"]
      }
    }]
}

print aws.get_cost_and_usage(TimePeriod=time_period, Granularity='DAILY', Metrics=['BlendedCost'], Filter=filters)

通过请求我的任何机器(爱尔兰)的成本,它显示一个错误,即 无法连接到 ce.eu-west-1.amazonaws.com

Traceback (most recent call last):
  File "test.py", line 22, in <module>
    print aws.service.cloudwatch.client.get_cost_and_usage(TimePeriod=time_period, Granularity='DAILY', Metrics=['BlendedCost'], Filter=filters)
  File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://ce.eu-west-1.amazonaws.com/"

也许这项服务在爱尔兰还不可用?

我在这里找不到 "Cost explorer" / "Billing" / "Cost management": http://docs.aws.amazon.com/general/latest/gr/rande.html#awssupport_region

我正在使用:

boto3==1.5.2

botocore==1.8.16

Cost Explorer 服务部署在 us-east-1。

您的所有查询都必须针对该地区,即:

client = boto3.client('ce', region_name='us-east-1')
client.get_cost_and_usage(....)

响应将包括您所在的所有地区。

请注意,当您导航到计费控制台时,AWS UI 也会提到 'Global'。