S3 using boto and SigV4 - missing host parameter

when developing, I used the S3 bucket in Ireland, which worked well. For production, I want to use the new location of Frankfurt S3, but apparently, in the new region of Frankfurt, SigV4 is used, which breaks my python script.

When adding the following block to ~ / .boto, I get the following error:

~ / .boto:

[s3] use-sigv4 = True 

Mistake:

 File "/usr/lib/python2.6/site-packages/boto/__init__.py", line 141, in connect_s3 return S3Connection(aws_access_key_id, aws_secret_access_key, **kwargs) File "/usr/lib/python2.6/site-packages/boto/s3/connection.py", line 196, in __init__ "When using SigV4, you must specify a 'host' parameter." boto.s3.connection.HostRequiredError: BotoClientError: When using SigV4, you must specify a 'host' parameter. 

Can anyone tell me how to specify the host parameter? I could not find this option in the aws / boto documentation.

+7
python amazon-s3 boto
source share
1 answer

Here are the documents for your exact error , as well as the exact source code that the S3Connection creates (and, in turn, your error).

When creating an S3Connection(aws_access_key_id, aws_secret_access_key, **kwargs) you need to pass an additional host=... element, which should be a simple string, for example 's3.amazonaws.com' , or similar for your installation.

Decision:

You can add this to your kwargs :

 kwargs.update({'host': 's3.amazonaws.com'}) 

or call it like:

 S3Connection(aws_access_key_id, aws_secret_access_key, host='s3.amazonaws.com', **kwargs) 
+9
source share

All Articles