Home Ask Login Register

Developers Planet

Your answer is one click away!

KalleJuhans February 2016

InvalidSignatureException when using boto3 for dynamoDB on aws

Im facing some sort of credentials issue when trying to connect to my dynamoDB on aws. Locally it all works fine and I can connect using env variables for AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION and then

dynamoConnection = boto3.resource('dynamodb', endpoint_url='http://localhost:8000')

When changing to live creds in the env variables and setting the endpoint_url to the dynamoDB on aws this fails with:

"botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the Query operation: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."

The creds are valid as they are used in a different app which talks to the same dynamoDB. Ive also tried not using env variables but rather directly in the method but the error persisted. Furthermore, to avoid any issues with trailing spaces Ive even used the credentials directly in the code. Im using Python v3.4.4.

Is there maybe a header that also should be set that Im not aware of? Any hints would be apprecihated.


Ive now also created new credentials (to make sure there are only alphanumerical signs) but still no dice.


garnaat February 2016

You shouldn't use the endpoint_url when you are connecting to the real DynamoDB service. That's really only for connecting to local services or non-standard endpoints. Instead, just specify the region you want:

dynamoConnection = boto3.resource('dynamodb', region_name='us-west-2')

Post Status

Asked in February 2016
Viewed 1,603 times
Voted 13
Answered 1 times


Leave an answer

Quote of the day: live life