2

I am new to aws, I am trying to use aws-cli to connect aws as I am confortable with commandline, and want to use to write the script to automate the process.

However I am getting error as below:

_
    attempt_number, caught_exception)
  File "/usr/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
EndpointConnectionError: Could not connect to the endpoint URL: "https://ec2.ap-southeast-1a.amazonaws.com/"
2017-07-08 20:30:52,763 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

Could not connect to the endpoint URL: "https://ec2.ap-southeast-1a.amazonaws.com/"

I have setup the profile user as in the config file.

[profile joey2]
output = json
region = ap-southeast-1a

the credential such as api key and secret is configured properly.

Could someone help to figure out what is cause of this issue. highly appreciate for any advice?

Joey Trang
  • 1,105
  • 2
  • 23
  • 44

1 Answers1

9

ap-southeast-1a is not a valid AWS Region, you need to use ap-southeast-1 instead. You're getting that connection error because https://ec2.ap-southeast-1a.amazonaws.com/ (which is what your input region is attempting to resolve to) does not exist. You can verify this via the EC2 Region documentation.

Region Name: Asia Pacific (Singapore)
Region: ap-southeast-1
Endpoint: ec2.ap-southeast-1.amazonaws.com

Further Reading

Anthony Neace
  • 25,013
  • 7
  • 114
  • 129
  • @Van, to explain... `ap-southeast-1a` is an Availability Zone within the `ap-southeast-1` region. The AWS CLI connections to a regional endpoint that connects to all Availability Zones in the region, so you only need to the region name. It's a common error that people make. – John Rotenstein Jul 08 '17 at 13:17
  • yeah, that is very beginer mistake, I have fixed it and it is working as cham now. – Joey Trang Jul 10 '17 at 03:45
  • It is easy to get lost because it is ap-southeast-1a that shows up in the "availability zone" column in AWS. – Audrius Meškauskas Jul 29 '19 at 11:31