awslabs / dynamodb-cross-region-library

A library to facilitate cross-region replication with Amazon DynamoDB Streams.
Apache License 2.0
275 stars 98 forks source link

com.amazonaws.AmazonServiceException InvalidSignatureException #34

Closed herechris closed 7 years ago

herechris commented 8 years ago

I've verified the key pair is correct and valid. It's defined in ~/.aws/config

java -jar dynamodb-cross-region-replication-1.1.0.jar --sourceEndpoint dynamodb.us-east-1.amazonaws.com --sourceTable --destinationEndpoint dynamodb.us-west-1.amazonaws.com --destinationTable

com.amazonaws.AmazonServiceException: 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 Canonical String for this request should have been 'POST /

amz-sdk-invocation-id:6f137dc7-3c6e-45e3-99fb-0416dffeeae8 amz-sdk-retry:10/12800/ content-length:51 content-type:application/x-amz-json-1.0 host:dynamodb.us-east-1.amazonaws.com user-agent:aws-sdk-java/1.10.77 Linux/4.4.11-23.53.amzn1.x86_64 OpenJDK_64-Bit_Server_VM/24.95-b01/1.7.0_101 x-amz-date:20160819T161205Z x-amz-target:DynamoDB_20120810.DescribeTable

amz-sdk-invocation-id;amz-sdk-retry;content-length;content-type;host;user-agent;x-amz-date;x-amz-target c861b51d332699336e6de18a9edc332105ab9ad2cd16a17afce7387cc6586a1d'

The String-to-Sign should have been 'AWS4-HMAC-SHA256 20160819T161205Z 20160819/us-east-1/dynamodb/aws4_request b000cd77e2b2905c8a49622056d52854ace5435f3049c46924f11b100bc23c72' (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: InvalidSignatureException; Request ID: MGK51SAPODBMFDCJTK14ITU1VNVV4KQNSO5AEMVJF66Q9ASUAAJG)

feelobot commented 7 years ago

+1

amcp commented 7 years ago

Endpoint and signing region are now different concepts in all SDK clients. I have split these up in my upcoming fixes so please try and see if they will address your issue. Need to use my update to the streams adapter as well.

amcp commented 7 years ago

Fixed.