Does boto3 support connecting a VPC endpoint to S3

We have a Python client that connects to Amazon S3 through the VPC endpoint. Our code uses boto, and we can connect and boot from S3.

After switching from boto to boto3, we noticed that the VPC endpoint connection no longer works. The following is a snippet of a copy that might reproduce the problem.

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')"

got the following error:

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'))

Does anyone know if boto3 supports connecting to S3 through a VPC endpoint and / or can it make it work? We are using boto3-1.4.0.

+4
source share

Source: https://habr.com/ru/post/1686669/


All Articles