The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.

AWS4-HMAC-SHA256, also known as Signature Version 4 or Sig v4 is 1 of 2 authentication mechanisms supported by S3. All AWS regions support Sig v4 but N. Virginia (US East 1) & many others also support the older Sig v2.

Amazon S3 supports Signature Version 4, a protocol for authenticating inbound API requests to AWS services, in all AWS regions. At this time, AWS Regions created before January 30, 2014 will continue to support the previous protocol, Signature Version 2. Any new Regions after January 30, 2014 will support only Signature Version 4 and therefore all requests to those Regions must be made with Signature Version 4.

β€” Amazon S3 Documentation

If you use Sig v2 with newer regions in AWS SDK, you get the error:

The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.

S3 documentation describes how to use Sig v4 in various SDKs. Here are a few examples:

Node.js
var s3 = new AWS.S3( {
    endpoint: 's3-eu-central-1.amazonaws.com',
    signatureVersion: 'v4',
    region: 'eu-central-1'
} );

or

AWS.config.update({
    signatureVersion: 'v4'
});
Python β€” Boto 3
from botocore.client import Config
s3 = boto3.resource(
    's3',
    aws_access_key_id='xxxxxx',
    aws_secret_access_key='xxxxxx',
    config=Config(signature_version='s3v4')
)
PHP
$s3Client = S3Client::factory(array('key'=>YOUR_AWS_KEY, 'secret'=>
YOUR_AWS_SECRET, 'signature' => 'v4', 'region'=>'eu-central-1'));
Java
System.setProperty(SDKGlobalConfiguration.ENFORCE_S3_SIGV4_SYSTEM_PROPERTY, "true")

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.