1

So here is my first test for S3 buckets using boto:

import boto

user_name, access_key, secret_key = "testing-user", "xxxxxxxxxxxxx", "xxxxxxxx/xxxxxxxxxxxx/xxxxxxxxxx(xxxxx)"
conn = boto.connect_s3(access_key, secret_key)
buckets = conn.get_all_buckets()

I get the following error:

Traceback (most recent call last):
  File "test-s3.py", line 9, in <module>
    buckets = conn.get_all_buckets()
  File "xxxxxx/lib/python2.7/site-packages/boto/s3/connection.py", line 440, in get_all_buckets
    response.status, response.reason, body)
boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>AKIAJMHSZXU6MORWA5GA</AWSAccessKeyId><StringToSign>GET


Mon, 18 May 2015 06:21:58 GMT
/</StringToSign><SignatureProvided>c/+YJAZVInsfmd5giMQmrh81DPA=</SignatureProvided><StringToSignBytes>47 45 54 0a 0a 0a 4d 6f 6e 2c 20 31 38 20 4d 61 79 20 32 30 31 35 20 30 36 3a 32 31 3a 35 38 20 47 4d 54 0a 2f</StringToSignBytes><RequestId>5733F9C8926497E6</RequestId><HostId>FXPejeYuvZ+oV2DJLh7HBpryOh4Ve3Mmj8g8bKA2f/4dTWDHJiG8Bpir8EykLYYW1OJMhZorbIQ=</HostId></Error>

How am I supposed to fix this?

Boto version is 2.38.0

Emanuele Paolini
  • 9,912
  • 3
  • 38
  • 64
  • Double-check your access key and secret key to verify that they are correct. Also, check the time on the client machine and make sure it is correct. – garnaat May 18 '15 at 11:45
  • Ok, I notice just now that providing a wrong password results in the same error message... I thought that authentication was fine because the error is raised after the boto.connect_s3 is successfully executed. I understand that maybe a lazy operation is involved... – Emanuele Paolini May 18 '15 at 12:55
  • The credentials aren't checked until a call is actually made. – garnaat May 18 '15 at 14:37
  • I've double checked the access key and secret key. I've created new credentials, downloaded secret.csv and copied these keys directly into my code. The clock of my computer is correct.... what else? Is the region relevant in any way? – Emanuele Paolini May 22 '15 at 07:27

2 Answers2

2

Had the same issue. In my case, my generated security key had a special character '+' in between. So I deleted my key and regenerated a new key and it worked with the new key with no '+'.

Source

Community
  • 1
  • 1
pratpor
  • 1,954
  • 1
  • 27
  • 46
0

Today, I saw an error response with SignatureDoesNotMatch while playing around an S3 API locally and replacing localhost with 127.0.0.1 fixed the problem in my case.

Juvanis
  • 25,802
  • 5
  • 69
  • 87