See next comment for the solution and request to add a example config to documentation
Hi
I'm trying to use thumbor-aws (that uses boto for the requests) with riak, that is mostly s3 compatible... but riak do not support signature V4 yet, it only supports for now v2 signature. So trying to use thumbor-aws i get this:
2017-03-09 21:59:00 thumbor:WARNING ERROR retrieving image from S3 static-bd/BB.png: {'ResponseMetadata': {'HTTPStatusCode': 400}, 'Error': {'Message': 'The authorization mechanism you have provided (AWS4-HMAC-SHA256) is not supported.', 'Code': 'InvalidRequest', 'Resource': '/None/static-bd/BB.png'}}
Thumbor-aws devs say they call boto, so they use any option there.
I tried to put this in $AWS_CONFIG_FILE
[default]
aws_access_key_id = (key)
aws_secret_access_key = (secret)
signature_version = s3
but still do not work.
What option can i add to enable the old V2 signature? Does boto3 still support the older signature v2?
If support for this was removed, can you please add it back, with a config option to switch it on?
Thanks for the help
I finally found the way to do this:
# cat /root/aws.credentials
[default]
aws_access_key_id = (KEY)
aws_secret_access_key =(SECRET)
s3 =
signature_version = s3
Hard to solve because this was very hard to search and it is only only very quickly referenced in the boto documentation and without definition of what is the "nested settings" format (https://boto3.readthedocs.io/en/latest/guide/configuration.html)
Maybe this should config should be added as a example to the documentation
That seems like a reasonable thing to add, marking this as a documentation enhancement.
+2 for @higuita - Yes, it's very important for developer who implementing stack with older object storages (with v2).
_I'm not sure, why it's not working when I using Config object with 'signature_version': 's3' property - maybe it's a bug ?_
My test code for v2:
import botocore
from botocore.config import Config
session = botocore.session.get_session()
def create_client(session, region, endpoint_url='', signature_version='s3', addressing_style='path'):
return session.create_client('s3', aws_access_key_id='ACCESS_KEY', aws_secret_access_key='SECRET_KEY',
region_name=region, endpoint_url=endpoint_url,
config=Config(s3={'addressing_style': addressing_style,
'signature_version': signature_version}))
client = create_client(session, "eu-central-1", endpoint_url="http://127.0.0.1:8080")
buckets = client.list_buckets()
print(buckets)
and when I need v2 is't MUST HAVE:
[default]
s3 =
signature_version = s3
Documentation on how to change config
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html
Most helpful comment
I finally found the way to do this:
Hard to solve because this was very hard to search and it is only only very quickly referenced in the boto documentation and without definition of what is the "nested settings" format (https://boto3.readthedocs.io/en/latest/guide/configuration.html)
Maybe this should config should be added as a example to the documentation