Reputation: 185
Im trying to use CostExplorer to estimate charges, filtered by 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)
By requesting the cost of any of my machines (Ireland), it shows an error that it is not possible to connect to 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/"
Maybe this service is not available in Ireland yet?
I cannot find "Cost explorer" / "Billing" / "Cost management" here: http://docs.aws.amazon.com/general/latest/gr/rande.html#awssupport_region
I'm using:
boto3==1.5.2
botocore==1.8.16
Upvotes: 1
Views: 2655
Reputation: 2970
The Cost Explorer service is deployed in us-east-1.
All of your queries must be directed to that region, i.e.:
client = boto3.client('ce', region_name='us-east-1')
client.get_cost_and_usage(....)
Response will include all your regions.
Notice the AWS UI also mentions 'Global' when you navigate to billing console.
Upvotes: 4