Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

S3 using boto and SigV4 - missing host parameter

when developing i used a S3 bucket in ireland, which worked well. For production i want to use the new "Frankfurt" location of S3, but apparently the new Frankfurt region uses the "SigV4" which breaks my python script.

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

~/.boto:

[s3]
use-sigv4 = True

Error:

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 anybody please tell me how to specify the "host" parameter? I couldn't find this parameter in a aws/boto documentation.

like image 610
fabs Avatar asked Nov 04 '14 20:11

fabs


1 Answers

Here's the docs for your exact error, as well as the exact source code that's creating the S3Connection (and in turn, your error).

In creating the S3Connection(aws_access_key_id, aws_secret_access_key, **kwargs), you need to pass in an additional item host=..., which should be a simple string like 's3.amazonaws.com', or similar for your setup.

Solution:

You can add this to your kwargs being passed:

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

or call it manually like:

S3Connection(aws_access_key_id, aws_secret_access_key, host='s3.amazonaws.com', **kwargs)
like image 154
VooDooNOFX Avatar answered Oct 28 '22 12:10

VooDooNOFX