Python Boto3 中的异常 - botocore.exceptions.EndpointConnectionError
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34685446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Exception in Boto3 - botocore.exceptions.EndpointConnectionError
提问by Liam Pieri
When trying to connect to a database with this python code to test the connection.
尝试使用此 python 代码连接到数据库以测试连接时。
import boto3
s3 = boto3.resource('s3')
for b in s3.buckets.all():
print b.name
I am getting this error thrown at me.
我收到了这个错误。
Traceback (most recent call last):
File "boto3_test.py", line 4, in <module>
for b in s3.buckets.all():
File "/usr/local/lib/python2.7/dist-packages/boto3/resources/collection.py", line 83, in __iter__
for page in self.pages():
File "/usr/local/lib/python2.7/dist-packages/boto3/resources/collection.py", line 161, in pages
pages = [getattr(client, self._py_operation_name)(**params)]
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 310, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 385, in _make_api_call
operation_model, request_dict)
File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 111, in make_request
return self._send_request(request_dict, operation_model)
File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 140, in _send_request
success_response, exception):
File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 213, in _needs_retry
caught_exception=caught_exception)
File "/usr/local/lib/python2.7/dist-packages/botocore/hooks.py", line 226, in emit
return self._emit(event_name, kwargs)
File "/usr/local/lib/python2.7/dist-packages/botocore/hooks.py", line 209, in _emit
response = handler(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 183, in __call__
if self._checker(attempts, response, caught_exception):
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 250, in __call__
caught_exception)
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 273, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 313, in __call__
caught_exception)
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 222, in __call__
return self._check_caught_exception(attempt_number, caught_exception)
File "/usr/local/lib/python2.7/dist-packages/botocore/retryhandler.py", line 355, in _check_caught_exception
raise caught_exception
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://s3.us-east-5.amazonaws.com/"
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 questionis 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.
奇怪的是,连接在当天早些时候工作,然后在它停止工作时昨天发生在我身上的同样的事情同时发生,所以我假设这是一个网络配置问题。这个问题是唯一一个与原始海报所述的解决方案相似的问题是取消我尝试过的 HTTP_PROXY 和 HTTPS_PROXY 的设置,但它没有用。
采纳答案by helloV
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.
您错误地配置了 AWS env。检查您的~/.aws/config
文件。您必须将其错误地配置为 us-east-5,这是一个无效区域。将其更改为us-east-1
. 或者aws configure
再次运行命令并指定正确的区域。
[default]
region = us-east-1
回答by NotSoShabby
We got this issue (with status code 500 returned) out of the blue.
我们突然发现了这个问题(返回状态代码 500)。
After some research we found out that there was some infra update on AWS which caused the service to be down.
经过一些研究,我们发现 AWS 上有一些基础设施更新导致服务关闭。
You can find the current down\up services per zone and upcoming down time here
您可以在此处找到每个区域的当前停机\停机服务以及即将到来的停机时间