pcj*_*tse 10 python python-2.7 boto3
我们有一个通过VPC端点连接到Amazon S3的Python客户端.我们的代码使用boto,我们可以从S3连接和下载.
从boto迁移到boto3后,我们注意到VPC端点连接不再有效.下面是一个可以重现问题的副本片段.
python -c "import boto3;s3 = boto3.resource('s3',aws_access_key_id='foo',aws_secret_access_key='bar');s3.Bucket('some-bucket').download_file('hello-remote.txt', 'hello-local.txt')"
Run Code Online (Sandbox Code Playgroud)
得到以下错误:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python27\lib\site-packages\boto3-1.4.0-py2.7.egg\boto3\s3\inject.py",
line 163, in bucket_download_file
ExtraArgs=ExtraArgs, Callback=Callback, Config=Config)
File "C:\Python27\lib\site-packages\boto3-1.4.0-py2.7.egg\boto3\s3\inject.py",
line 125, in download_file
extra_args=ExtraArgs, callback=Callback)
File "C:\Python27\lib\site-packages\boto3-1.4.0-py2.7.egg\boto3\s3\transfer.py
", line 269, in download_file
future.result()
File "build\bdist.win32\egg\s3transfer\futures.py", line 73, in result
File "build\bdist.win32\egg\s3transfer\futures.py", line 233, in result
botocore.vendored.requests.exceptions.ConnectionError: ('Connection aborted.', e
rror(10060, 'A connection attempt failed because the connected party did not pro
perly respond after a period of time, or established connection failed because c
onnected host has failed to respond'))
Run Code Online (Sandbox Code Playgroud)
有谁知道boto3是否支持通过VPC端点与S3的连接和/或是否能够使其工作?我们正在使用boto3-1.4.0.
这很可能是您的 VPC 终端节点策略中的配置错误。如果您的策略是正确的,那么 Boto3 永远不会确切地知道它如何能够到达 S3 位置,这实际上取决于策略是否允许/禁止此类流量。
以下是您可以执行的故障排除操作的快速演练:https://aws.amazon.com/premiumsupport/knowledge-center/connect-s3-vpc-endpoint/
其他相关文档:
| 归档时间: |
|
| 查看次数: |
820 次 |
| 最近记录: |