django-storages icon indicating copy to clipboard operation
django-storages copied to clipboard

SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method.

Open orimboolak opened this issue 6 years ago • 35 comments

Keep getting this error when i try to retrieve the saved image via url. Kindly help

orimboolak avatar Oct 29 '19 23:10 orimboolak

Could you figure out a solution?

DevMaxIT avatar Nov 20 '19 17:11 DevMaxIT

I had this issue with a bucket in us-east-2. Without going into the last 2 hours of archeology of boto3 issues and storages code. I solved it by setting the following in my settings.py.

AWS_S3_ADDRESSING_STYLE = "virtual"

I am moving this chart up from below to help give more visibility to it.

Region Setting
us-east-1 default or AWS_S3_SIGNATURE_VERSION = "s3v4"
us-east-2 AWS_S3_ADDRESSING_STYLE = "virtual"
ap-northeast-1 AWS_S3_SIGNATURE_VERSION = "s3v4"
ap-southeast-2 AWS_S3_ADDRESSING_STYLE = "virtual"
ap-south-1 AWS_S3_ADDRESSING_STYLE = "virtual"
eu-central-1 AWS_S3_ADDRESSING_STYLE = "virtual"
eu-central-1 AWS_S3_ADDRESSING_STYLE = "virtual" AWS_S3_ENDPOINT_URL = 'https://s3.eu-central-1.amazonaws.com'
eu-west-1 AWS_S3_SIGNATURE_VERSION = "s3v4" AWS_S3_ADDRESSING_STYLE = "virtual"
eu-west-2 AWS_S3_ADDRESSING_STYLE = "virtual"
eu-west-3 AWS_S3_ADDRESSING_STYLE = "virtual"
ca-central-1 AWS_S3_ADDRESSING_STYLE = "virtual"

Based on a comment make sure you are up-to-date with the latest version of this package.

buddylindsey avatar Feb 19 '20 23:02 buddylindsey

Spend 5 hours and this worked for me, @buddylindsey solution didn't worked for me AWS_DEFAULT_ACL = 'private' AWS_S3_SIGNATURE_VERSION = 's3v4'

ghost avatar May 20 '20 20:05 ghost

@AchintyaRanjanChaudhary what region where you in and version of boto3? I found those settings, but the version of boto3 I had was already using s3v4.

buddylindsey avatar May 20 '20 20:05 buddylindsey

I had this issue with a bucket in us-east-2. Without going into the last 2 hours of archeology of boto3 issues and storages code. I solved it by setting the following in my settings.py.

AWS_S3_ADDRESSING_STYLE = "virtual"

Your a life saver!!! Thanks.

rozeweb avatar May 22 '20 02:05 rozeweb

@buddylindsey boto version --> boto3==1.13.13 AWS region -->ap-northeast-1 django-storage --> django-storages==1.9.1

ghost avatar May 22 '20 06:05 ghost

So it looks like so far

Region Setting
us-east-1 default or AWS_S3_SIGNATURE_VERSION = "s3v4"
us-east-2 AWS_S3_ADDRESSING_STYLE = "virtual"
ap-northeast-1 AWS_S3_SIGNATURE_VERSION = "s3v4"
eu-central-1 AWS_S3_ADDRESSING_STYLE = "virtual"
eu-west-2 AWS_S3_ADDRESSING_STYLE = "virtual"
eu-west-3 AWS_S3_ADDRESSING_STYLE = "virtual"

If we get more variations from people or other regions I can update this table.

buddylindsey avatar May 28 '20 17:05 buddylindsey

I had this issue with a bucket in us-east-2. Without going into the last 2 hours of archeology of boto3 issues and storages code. I solved it by setting the following in my settings.py.

AWS_S3_ADDRESSING_STYLE = "virtual"

I love you.

ghost avatar Jun 14 '20 14:06 ghost

getting this error again and again..none of the above worked..but observed that url of file from website does not contain "Amz-Security-Token" field..how to resolve that?

hi-18-K avatar Jul 07 '20 08:07 hi-18-K

AWS_S3_ADDRESSING_STYLE = "virtual" also works for eu-central-1

krystofbe avatar Jul 31 '20 11:07 krystofbe

I had this issue with a bucket in us-east-2. Without going into the last 2 hours of archeology of boto3 issues and storages code. I solved it by setting the following in my settings.py.


AWS_S3_ADDRESSING_STYLE = "virtual"

Dude! This Totally worked thanks.

Psyborgs-git avatar Aug 19 '20 14:08 Psyborgs-git

AWS_S3_ADDRESSING_STYLE = "virtual"

Also works for eu-west-3

aureliendebord avatar Nov 17 '20 13:11 aureliendebord

Added a new, identical setting bucket in region us-east-2 for use in dev only, and had to add AWS_S3_ADDRESSING_STYLE = "virtual" thanks @buddylindsey 1st bucket worked without it, but also works with it. 🤷🏻‍♂️ The first bucket didn't work until I added AWS_S3_SIGNATURE_VERSION = "s3v4", but the new one works with or without it. Not sure if the 1st still needs AWS_S3_SIGNATURE_VERSION too, but I'm leaving it for now.

Is it django-storages causing all these inconsistencies or AWS?

davidysoards avatar Nov 18 '20 05:11 davidysoards

First of all thank you. This answers really helped. Second: I have a bucket at us-east-1 and the default didn't work neither the WS_S3_ADDRESSING_STYLE = "virtual". What it worked was AWS_S3_SIGNATURE_VERSION = "s3v4"

gcmestre avatar Dec 06 '20 11:12 gcmestre

I had this issue with a bucket in us-east-2. Without going into the last 2 hours of archeology of boto3 issues and storages code. I solved it by setting the following in my settings.py.

AWS_S3_ADDRESSING_STYLE = "virtual"

Dude i love you tks !!!

dunderJB avatar Dec 22 '20 03:12 dunderJB

@buddylindsey Thanks alot

AWS_S3_ADDRESSING_STYLE = "virtual"

worked for us-east-2

Vinay-Indoria avatar Jan 21 '21 14:01 Vinay-Indoria

AWS_S3_ADDRESSING_STYLE = "virtual" worked for eu-west-2. Thank you! ♥️

adamcharnock avatar Feb 05 '21 12:02 adamcharnock

Many thanks for this info. This saved me another hour of searching through code

shdigitalpy avatar Mar 26 '21 15:03 shdigitalpy

AWS_S3_ADDRESSING_STYLE = "virtual" worked for eu-west-2. Thank You..

vinodkr494 avatar May 13 '21 10:05 vinodkr494

AWS_S3_ADDRESSING_STYLE = "virtual"

Works for ap-southeast-2. Thank you!

dinie avatar Jun 21 '21 18:06 dinie

I tried all of these solutions for the correct timezones and for some reason it's still not working 🤦‍♂️ I've triple checked my keys and tried both:

AWS_S3_ADDRESSING_STYLE = "virtual"

and

AWS_S3_SIGNATURE_VERSION = "s3v4"

one at a time and even at the same time.

I made a new bucket under us-east-1 just because that's what was shown in other answers and it still didn't work with either settings.

ZackPlauche avatar Jul 06 '21 09:07 ZackPlauche

This works for the region - ap-south-1

AWS_S3_ADDRESSING_STYLE = "virtual"

Ram-95 avatar Jul 18 '21 09:07 Ram-95

So it looks like so far Region Setting us-east-1 default or AWS_S3_SIGNATURE_VERSION = "s3v4" us-east-2 AWS_S3_ADDRESSING_STYLE = "virtual" ap-northeast-1 AWS_S3_SIGNATURE_VERSION = "s3v4" eu-central-1 AWS_S3_ADDRESSING_STYLE = "virtual" eu-west-2 AWS_S3_ADDRESSING_STYLE = "virtual" eu-west-3 AWS_S3_ADDRESSING_STYLE = "virtual"

If we get more variations from people or other regions I can update this table.

"virtual" setting works for ca-central-1 as well.

PirateDevCom avatar Aug 29 '21 06:08 PirateDevCom

While troubleshooting student projects I have found that this is caused by there being a / in the secret access key. I didn't know about these settings but generating new credentials without the / would solve it.

asdfractal avatar Feb 14 '22 04:02 asdfractal

This also works for eu-west-1:

AWS_S3_SIGNATURE_VERSION = "s3v4"
AWS_S3_ADDRESSING_STYLE = "virtual"

radupm avatar Mar 23 '22 15:03 radupm

None of these worked for me. us-east-2

Edit: Updating from storages 1.9 to 1.13.1 fixed this error

JMIdeaMaker avatar Dec 11 '22 16:12 JMIdeaMaker

When using eu-central-1:

i used AWS_S3_ADDRESSING_STYLE = "virtual"

but still got an error. Adding an Endpoint + Addressing style solved it for me AWS_S3_ENDPOINT_URL = 'https://s3.eu-central-1.amazonaws.com'

misterpip avatar Jun 12 '23 11:06 misterpip

I had this issue with a bucket in us-east-2. Without going into the last 2 hours of archeology of boto3 issues and storages code. I solved it by setting the following in my settings.py.

AWS_S3_ADDRESSING_STYLE = "virtual"

I am moving this chart up from below to help give more visibility to it.

Region Setting us-east-1 default or AWS_S3_SIGNATURE_VERSION = "s3v4" us-east-2 AWS_S3_ADDRESSING_STYLE = "virtual" ap-northeast-1 AWS_S3_SIGNATURE_VERSION = "s3v4" ap-southeast-2 AWS_S3_ADDRESSING_STYLE = "virtual" ap-south-1 AWS_S3_ADDRESSING_STYLE = "virtual" eu-central-1 AWS_S3_ADDRESSING_STYLE = "virtual" eu-central-1 AWS_S3_ADDRESSING_STYLE = "virtual" AWS_S3_ENDPOINT_URL = 'https://s3.eu-central-1.amazonaws.com' eu-west-1 AWS_S3_SIGNATURE_VERSION = "s3v4" AWS_S3_ADDRESSING_STYLE = "virtual" eu-west-2 AWS_S3_ADDRESSING_STYLE = "virtual" eu-west-3 AWS_S3_ADDRESSING_STYLE = "virtual" ca-central-1 AWS_S3_ADDRESSING_STYLE = "virtual" Based on a comment make sure you are up-to-date with the latest version of this package.

For eu-central-1 you need both settings as they are. Cheers buddy! You got a beer from me.

milenmihaylov avatar Sep 14 '23 20:09 milenmihaylov

For eu-central-1 I needed to set 3 mentioned before variables: AWS_S3_ADDRESSING_STYLE = "virtual" AWS_S3_ENDPOINT_URL = 'https://s3.eu-central-1.amazonaws.com' AWS_S3_ADDRESSING_STYLE = "virtual"

and also 1 additional: AWS_S3_REGION_NAME = 'eu-central-1'

MarcinR1989 avatar Sep 15 '23 22:09 MarcinR1989

Ran into this issue today and found both combinations work (for a public bucket)

AWS_S3_REGION_NAME = 'us-east-2'
AWS_S3_ENDPOINT_URL = f'https://s3.{AWS_S3_REGION_NAME}.amazonaws.com'

or

AWS_S3_REGION_NAME = 'us-east-2'
AWS_S3_ADDRESSING_STYLE = 'path'

along with my AWS_STORAGE_BUCKET_NAME

Jackevansevo avatar Nov 01 '23 14:11 Jackevansevo