Emanuele Paolini
Emanuele Paolini

Reputation: 10172

my first test with boto fails with SignatureDoesNotMatch

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

Upvotes: 1

Views: 2321

Answers (2)

Juvanis
Juvanis

Reputation: 25950

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.

Upvotes: 0

pratpor
pratpor

Reputation: 2104

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

Upvotes: 2

Related Questions