关于python:Boto3中的异常-botocore.exceptions.EndpointConnectionError

Exception in Boto3 - botocore.exceptions.EndpointConnectionError

当尝试使用此python代码连接到数据库以测试连接时。

1
2
3
4
5
import boto3
s3 = boto3.resource('s3')

for b in s3.buckets.all():
   print b.name

我正在向我抛出此错误。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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/"

奇怪的是,该连接在当天早些时候正常工作,然后又停止工作,昨天同一时间发生在我身上的同一件事,因此我假设这是网络配置问题。这个问题是唯一与原始发布者说的解决方案类似的问题,该解决方案是我尝试取消HTTP_PROXY和HTTPS_PROXY的设置,但是没有用。


您错误地配置了AWS env。检查您的~/.aws/config文件。您必须将其错误地配置为us-east-5,这是无效的区域。将其更改为us-east-1。或再次运行aws configure命令并指定正确的区域。

1
2
[default]
region = us-east-1


我们突然发现了这个问题(状态码为500)。

经过研究,我们发现AWS上的一些基础设施更新导致服务关闭。

您可以在此处找到每个区域的当前down \\\\ up服务以及即将出现的宕机时间