Unable to use SNS
Getting this error:
AWS::SNS::Errors::SignatureDoesNotMatch: 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 /
content-length:71 content-type:application/x-www-form-urlencoded; charset=utf-8 host:sns.us-east-1.amazonaws.com user-agent:aws-sdk-ruby/1.14.1 ruby/1.9.2 x86_64-darwin12.3.0 x-amz-content-sha256:395f29ec2577398d2c47bd5cbb7c6aa6d332c003c28a670d1abbf2addf353dad x-amz-date:20130820T233416Z
content-length;content-type;host;user-agent;x-amz-content-sha256;x-amz-date 395f29ec2577398d2c47bd5cbb7c6aa6d332c003c28a670d1abbf2addf353dad'
The String-to-Sign should have been 'AWS4-HMAC-SHA256 20130820T233416Z 20130820/us-east-1/sns/aws4_request 115ab7a4adcc6b69b644e512fad7ce14a150a8814c326e2ba1a2672ad93c890f'
Can you provide code that reproduces this error?
AWS.config({ :access_key_id => '...', :secret_access_key => '...', })
sns=AWS::SNS.new c = sns.client c.list_topics
I can't reproduce this. Have you tried updating to the latest version of the SDK (1.15.0)?
If this still happens on the latest version, run the following command:
$ aws-rb -v -e 'AWS.sns.client.list_topics'
And provide the output (make sure to sanitize any private information)
Ran the command. It says it's unable to find my credentials but I do have aws-sdk.rb file with a call to configure it.
Actually I think that's because the command doesn't run the aws-sdk.rb. Seeing this now:
WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.7.8
Just above the same error I had before.
Got rid of the warning but the error remains (note aws-sdk-1.15.0):
AWS::SNS::Errors::SignatureDoesNotMatch: 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
....
The String-to-Sign should have been
from /Users/rodrigo/.rvm/gems/ruby-1.9.2-p320/gems/aws-sdk-1.15.0/lib/aws/core/client.rb:366:in `return_or_raise'
from /Users/rodrigo/.rvm/gems/ruby-1.9.2-p320/gems/aws-sdk-1.15.0/lib/aws/core/client.rb:467:in `client_request'
from (eval):3:in `list_topics'
from (irb):1
from /Users/rodrigo/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.14/lib/rails/commands/console.rb:47:in `start'
from /Users/rodrigo/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.14/lib/rails/commands/console.rb:8:in `start'
from /Users/rodrigo/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.14/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Same error. I just tried S3 and same thing happens:
AWS.s3.buckets.each { |bucket| bucket }
AWS::S3::Errors::SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method.
from /Users/rodrigo/.rvm/gems/ruby-1.9.2-p320/gems/aws-sdk-1.15.0/lib/aws/core/client.rb:366:in return_or_raise' from /Users/rodrigo/.rvm/gems/ruby-1.9.2-p320/gems/aws-sdk-1.15.0/lib/aws/core/client.rb:467:inclient_request'
from (eval):3:in list_buckets' from /Users/rodrigo/.rvm/gems/ruby-1.9.2-p320/gems/aws-sdk-1.15.0/lib/aws/s3/bucket_collection.rb:144:ineach'
from (irb):7
from /Users/rodrigo/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.14/lib/rails/commands/console.rb:47:in start' from /Users/rodrigo/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.14/lib/rails/commands/console.rb:8:instart'
from /Users/rodrigo/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.14/lib/rails/commands.rb:41:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `
Do I need to specify the region?
Try the following:
$ export AWS_ACCESS_KEY_ID='...'
$ export AWS_SECRET_ACCESS_KEY='...'
$ aws-rb -v -e 'AWS.sns.client.list_topics'
(only list the output of the last command, aws-rb)
I added the region too ... didn't help.
I am an idiot! Mixed dev and prod keys. My sincere apologies, thank you for helping out!
I was just writing this. Glad you got it sorted!