Reputation: 441
I am trying to fetch the daily cost of all resource having tag {'key': 'string', 'Values':['string']}
in a region, for this i am using boto3 CostExplorer
APIs.
But I am getting an error botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://ce.eu-west-3.amazonaws.com/"
here is code that i am using
import boto3
client = boto3.client('ce')
response = client.get_cost_and_usage(
TimePeriod={
'Start': '2020-02-01',
'End': '2020-03-01'
},
Metrics=['BlendedCost'],
Granularity='DAILY',
Filter={
'Tags': {'Key': 'string', 'Values': ['string']}
}
)
print(response)
Upvotes: 1
Views: 1623
Reputation: 3180
AWS Cost Explorer is only available in us-east-1 currently.
Refer to this link for the current list of supported regions: Amazon Cost Explorer Supported Regions AWS Service Endpoints
Resolution:
You'll need to change the region accordingly in your .aws/config
or set the correct region when creating the client for AWS Cost Explorer as follows :
import boto3
ce-client = boto3.client('ce', region_name='us-east-1')
Upvotes: 2