When trying to connect to a database with this python code to test the connection.
JavaScript
x
6
1
import boto3
2
s3 = boto3.resource('s3')
3
4
for b in s3.buckets.all():
5
print b.name
6
I am getting this error thrown at me.
JavaScript
1
35
35
1
Traceback (most recent call last):
2
File "boto3_test.py", line 4, in <module>
3
for b in s3.buckets.all():
4
File "/usr/local/lib/python2.7/dist-packages/boto3/resources/collection.py", line 83, in __iter__
5
for page in self.pages():
6
File "/usr/local/lib/python2.7/dist-packages/boto3/resources/collection.py", line 161, in pages
7
pages = [getattr(client, self._py_operation_name)(**params)]
8
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 310, in _api_call
9
return self._make_api_call(operation_name, kwargs)
10
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 385, in _make_api_call
11
operation_model, request_dict)
12
File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 111, in make_request
13
return self._send_request(request_dict, operation_model)
14
File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 140, in _send_request
15
success_response, exception):
16
File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 213, in _needs_retry
17
caught_exception=caught_exception)
18
File "/usr/local/lib/python2.7/dist-packages/botocore/hooks.py", line 226, in emit
19
return self._emit(event_name, kwargs)
20
File "/usr/local/lib/python2.7/dist-packages/botocore/hooks.py", line 209, in _emit
21
response = handler(**kwargs)
22
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 183, in __call__
23
if self._checker(attempts, response, caught_exception):
24
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 250, in __call__
25
caught_exception)
26
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 273, in _should_retry
27
return self._checker(attempt_number, response, caught_exception)
28
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 313, in __call__
29
caught_exception)
30
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 222, in __call__
31
return self._check_caught_exception(attempt_number, caught_exception)
32
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 355, in _check_caught_exception
33
raise caught_exception
34
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://s3.us-east-5.amazonaws.com/"
35
The strange part is that the connection was working earlier in the day and then at it stopped working the same thing happened to me yesterday at the same time so I am assuming it is a network configuration issue. This question is the only one that is similar the solution the original poster stated was to unset both HTTP_PROXY and HTTPS_PROXY which I attempted but it did not work.
Advertisement
Answer
You have configured AWS env incorrectly. Check your ~/.aws/config
file. You must have configured it incorrectly as us-east-5 which is an invalid region. Change it to us-east-1
. Or run aws configure
command again and specify the correct region.
JavaScript
1
3
1
[default]
2
region = us-east-1
3