'AWS S3 CLI - Could not connect to the endpoint URL
$ aws s3 ls
Could not connect to the endpoint URL: "https://s3.us-east-1a.amazonaws.com/"
What could be the problem?
Solution 1:[1]
first you use 'aws configure' then input the access key, and secret key, and the region. the region you input would be important for this problem. try to input something like 's3.us-east-1', not 's3.us-east-1a'. it will solve the issue.
Solution 2:[2]
If none of solutions given above works,also check your permissions and firewall settings. In my case adding proxy environment variables did the job.
For Linux or mac
$ export HTTP_PROXY=http://<YOUR PROXY IP>:<PORT>
$ export HTTPS_PROXY=http://<YOUR PROXY IP>:<PORT>
For Windows
set HTTP_PROXY=http://<YOUR PROXY IP>:<PORT>
Solution 3:[3]
Some AWS services are just available in specific regions that do not match your actual region. If this is the case you can override the standard setting by adding the region to your actual cli command.
This might be a handy solution for people that do not want to change their default region in the config file. IF your general config file is not set: Please check the suggestions above.
In this example the region is forced to eu-west-1 (e.g. Ireland):
aws s3 ls --region=eu-west-1
Tested and used with aws workmail to delete users:
aws workmail delete-user --region=eu-west-1 --organization-id [org-id] --user-id [user-id]
I derived the idea from this thread and it works perfect for me - so I wanted to share it. Hope it helps!
Solution 4:[4]
You should specify the region in your CLI script, rather than rely on default region specified using aws configure (as the current most popular answer asserts). Another answer alluded to that, but the syntax is wrong if you're using CLI via AWS Tools for Powershell.
This example forces region to us-west-2 (Northern California), PowerShell syntax:
aws s3 ls --region us-west-2
Solution 5:[5]
Probably, there is something wrong with the default region while configuring aws. In your case, the URL says "https://s3.us-east-1a.amazonaws.com/"
In your command prompt,
aws configure, enter your keys, Now fix your region from us-east-1a to us-east-1.
Kindly check the syntax according to the CLI you are using. This will be helpful.
Solution 6:[6]
This worked for me.
- Use debug option to get clear idea of bug
aws ec2 describe-instances --instance-ids (myid) --region ap-south-1 --debug
I got following issue.
EndpointConnectionError: Could not connect to the endpoint URL: "https://ec2.ap-south-1b.amazonaws.com/"
- I tried to Ping but it was not working
ping ec2.ap-south-1b.amazonaws.com ping: ec2.ap-south-1b.amazonaws.com: Name or service not known
- I checked for invalid value for Region when using aws configure
but it was configured properly
[default] region = ap-south-1
- Then , I went to **IAM -> Users - > (yourusername) - > Add Permissions
and I added "AdministratorAccess" Policy**.
- After that everything worked for me.
MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): ec2.ap-south-1.amazonaws.com:443 MainThread - urllib3.connectionpool - DEBUG - https://ec2.ap-south-1.amazonaws.com:443 "POST / HTTP/1.1" 200 7176
Solution 7:[7]
You should do the following on the CLI :
1. aws configure'
2. input the access key
3. input secret key
4. and then the region i.e : eu-west-1 (leave the a or b after the 1)
Solution 8:[8]
Assuming that your profile in ~/aws/config is using the region (instead of AZ as per your original question); the other cause is your client's inability to connect to s3.us-east-1.amazonaws.com. In my case, I was unable to resolve that DNS name due to an error in my network configuration. Fixing the DNS issue solved my problem.
Solution 9:[9]
Check the .aws directory under home directory. Windows: C:\Users<home-name>.aws Linux: ~/.aws
Under this directory, you will find the config as well as credentials file. It will have the information from the aws configure that you may have run before. IF not, then
Run
aws configureEnter the access key - secret key - enter secret key region - (ap-southeast-1 or us-east-1 or any other regions) format - (json or leave it blank, it will pick up default values you may simply hit enter)From the Step 2, you should see the config file, open it, it should have the region. Please ensure there is region specified.
You may now run the following command to list the buckets
aws s3 lsIt should work fine.
Solution 10:[10]
In case it is not working in your default region, try providing a region close to you. This worked for me:
PS C:\Users\shrig> aws configure
AWS Access Key ID [****************C]:**strong text**
AWS Secret Access Key [****************WD]:
Default region name [us-east1]: ap-south-1
Default output format [text]:
Solution 11:[11]
Weirdly, in my case restarting my laptop has helped. I've been using VPN lately, I think it messed up some network settings causing this error.
Solution 12:[12]
Couple things I've done to fix this :
- Updated my CLI and it given this error (previous error was "
aws connection aborted error 10013") Tried to nslookup aws s3 endpoing : nslookup s3.us-east-2.amazonaws.com
DNS request timed out. timeout was 2 seconds. Server: UnKnown Address: 192.168.10.1
-> hmmm very weird
Went to windows network troubleshooting and selected to test access to specific page. It informed that Windows firewall blocked the connection. Fixed this
Received a new error , after fixing the request through firewal :
An error occurred (RequestTimeTooSkewed) when calling the ListBuckets operation: The difference between the request time and the current time is too large.
Updated my date & time to automatic -> Fixed
Solution 13:[13]
Everyone has different defaults, and interestingly it will change after time. As an example, first I was on global, and then after 15 minutes it shows Ohio (which is us-east-2).
The best approach is to check it during your work -- in console of your AWS working area, just set it on the right above side near your name on top bar check your region name and click on the down arrow to see your region.
In AWS CLI type aws configure or aws2 configure, give your access and secret id, then during default region, write your region and press Enter.
You will definitely get access to specific region set and it will work.
Solution 14:[14]
The solution to my problem was to run:
sudo aws configure
Enter your credentials and then run:
sudo aws s3 ls
A different solution was to make sure that the region in the .aws/config file is the same as the endpoints
Solution 15:[15]
On Windows run the aws configure command again and reset region without the letter for example if your region is us-east-1a you need to change it to us-east-1 in order for it to work.
Solution 16:[16]
Check your environment settings:
set |& grep REGION
I had a typo in my AWS_REGION and AWS_DEFAULT_REGION environment variables, so it was trying to access a non-existant region.
Solution 17:[17]
You need to specify the region at the end of the command eg:- --region ap-south-1
https://aws.amazon.com/cli/ --> download --> install cmd --> aws configure --> AWS Access Key ID --> go to security credentials --> AWS Access Key ID --> download accesskey cmd --> AWS Access Key ID [None]: AKIAfdgxdgffh --> AWS Secret Access Key [None]: qPfMZ7m7qsDdgdfhdfhsdgsdhgds aws s3 mb s3://aaquib123 --region ap-south-1 --> bucket created in mumbai or specify region according to your need aws s3 ls --region ap-south-1 --> check bucket aws s3 rb s3://aaquib123 --region ap-south-1 --> remove bucket
Sync your laptop file with S3 --> create a folder on desktop --> AWS --> cd C:\Users\NIC\OneDrive\Desktop\AWS --> folder location --> aws s3 sync . s3://aaquib321 --region ap-south-1 --> synced with aws S3 --> go to aws and check s3 is synced --> delete your desktop file from in AWS folder --> aws s3 sync s3://aaquib321 . --region ap-south-1 --> copied from S3 to desktop folder AWS --> if deleted from desktop aws s3 rm s3://aaquib321 --recursive --exclude "node-key.pem" --region ap-south-1 --> empty bucket except node-key.pem aws s3 rm s3://aaquib321 --recursive --region ap-south-1 --> remove all files aws s3 rb s3://aaquib321 --region ap-south-1 --> remove bucket
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow



