作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
当尝试使用此 python 代码连接到数据库以测试连接时。
import boto3
s3 = boto3.resource('s3')
for b in s3.buckets.all():
print b.name
我收到了这个错误。
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/"
奇怪的是,连接在当天早些时候工作,然后停止工作,昨天同一时间我也发生了同样的事情,所以我假设这是网络配置问题。 This question是唯一一个类似于原始发帖者所说的解决方案是取消设置 HTTP_PROXY 和 HTTPS_PROXY 的解决方案,我尝试过但没有用。
最佳答案
您没有正确配置 AWS 环境。检查您的 ~/.aws/config
文件。您一定是错误地将其配置为 us-east-5,这是一个无效区域。将其更改为 us-east-1
。或者再次运行 aws configure
命令并指定正确的区域。
[default]
region = us-east-1
关于python - Boto3 中的异常 - botocore.exceptions.EndpointConnectionError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34685446/
当尝试使用此 python 代码连接到数据库以测试连接时。 import boto3 s3 = boto3.resource('s3') for b in s3.buckets.all(): p
我只是按照这些说明 ( Link ) 在我的 EC2 实例上安装了 AWS CloudWatch。 我更新了我的存储库: sudo yum update -y 我安装了 awslogs 包:sudo
我正在尝试使用Amazon Kendra构建一个语义搜索引擎。我在Sagemaker的Jupyter笔记本上写了代码。我被困在了以下部分:。代码:。错误:。我在存储代码中使用的数据集的S3存储桶中将‘
我是一名优秀的程序员,十分优秀!