Blaise Cosico
Blaise Cosico

Reputation: 13

Failed to establish a new connection with AWS CLI ce command

I'm new to using AWS CLI and I wanted to use the CostExplorer CLI command to pull my current bill.

I am currently billed for 1 dollar in my invoice for October 01 - October 31

This is the code that I input:

aws ce get-cost-and-usage \
--time-period Start=2019-10-01,End=2019-10-31 \
--granularity MONTHLY \
--metrics "BlendedCost" "UnblendedCost" "UsageQuantity" \
--group-by Type=DIMENSION,Key=SERVICE

I am currently getting this error:

HTTPSConnectionPool(host='ce.us-ease-1.amazonaws.com', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<botocore.awsrequest.AWSHTTPSConnection object at 0x7fcce33ff048>: Failed to establish a new connection: [Errno -2] Name or service not known',))

any ideas on what it means? or how to fix it?

Upvotes: 1

Views: 4542

Answers (1)

Adiii
Adiii

Reputation: 60046

Seems like the region name is not correct in the ~/.aws/config, as AWS-CLI use default region from the configuration file.

HTTPSConnectionPool(host='ce.us-ease-1.amazonaws.com', port=443):

There is no such region name us-ease-1, this should be us-east-1

You can correct the region name in config file or you can pass --region to the AWS-CLI command.

aws ce get-cost-and-usage --time-period Start=2019-10-01,End=2019-10-31 --granularity MONTHLY --metrics "BlendedCost" "UnblendedCost" "UsageQuantity" --group-by Type=DIMENSION,Key=SERVICE --region us-west-2

Upvotes: 2

Related Questions