aws-sdk-ruby error: The request signature we calculated does not match the
signature you provided
When I ran the sample in latest commit 99b237 of aws-sdk-ruby, I got the
error "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. ". I've set the access_key_id and
secret_access_key in samples/config.xml.
In my real code using EMR, it has the same error.
is there anyone encountered the same issue? any clue to solve it?
The code I'm using in my Rails app:
require 'logger'
AWS.config(access_key_id: "******",
secret_access_key: "******",
region: 'us-east-1',
http_wire_trace:true,
logger: Logger.new($stdout),
log_level: :debug,
log_formatter: AWS::Core::LogFormatter.colored)
emr = AWS::EMR.new
emr.job_flows.each do |job_flow|
puts job_flow.id
end
The err output:
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:2
content-type:application/x-amz-json-1.1
host:elasticmapreduce.us-east-1.amazonaws.com
user-agent:aws-sdk-ruby/1.19.0 ruby/1.9.3 x86_64-darwin12.4.0
x-amz-content-sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
x-amz-date:20130929T080447Z
x-amz-target:ElasticMapReduce.DescribeJobFlows
content-length;content-type;host;user-agent;x-amz-content-sha256;x-amz-date;x-amz-target
44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a'
The String-to-Sign should have been
'AWS4-HMAC-SHA256
20130929T080447Z
20130929/us-east-1/elasticmapreduce/aws4_request
6535fb5287442083c631dda7c12a20f6ffeeef08c21b4de516ecc46cf91d863d'
The output of sample code which is the same as the output of my code above.
$ ruby get_queue_list.rb
Getting list of all queues ...
/Users/mingming/.rvm/gems/ruby-1.9.3-p429@gemset193/gems/aws-sdk-1.19.0/lib/aws/core/client.rb:366:in
`return_or_raise': 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.
(AWS::SQS::Errors::SignatureDoesNotMatch)
The Canonical String for this request should have been
'POST
/
content-length:71
content-type:application/x-www-form-urlencoded; charset=utf-8
host:sqs.us-east-1.amazonaws.com
user-agent:aws-sdk-ruby/1.19.0 ruby/1.9.3 x86_64-darwin12.4.0
x-amz-content-sha256:a0e4deb554005fd78596b12837036e3b0eb5804bb2f824d680a274ef42ef2df7
x-amz-date:20130929T073549Z
content-length;content-type;host;user-agent;x-amz-content-sha256;x-amz-date
a0e4deb554005fd78596b12837036e3b0eb5804bb2f824d680a274ef42ef2df7'
The String-to-Sign should have been
'AWS4-HMAC-SHA256
20130929T073549Z
20130929/us-east-1/sqs/aws4_request
09e6cc8a057e2bc9e7f0ffc21dcc825d4c759ba60d1ff8c77628f7064f46cf70'
from
/Users/mingming/.rvm/gems/ruby-1.9.3-p429@gemset193/gems/aws-sdk-1.19.0/lib/aws/core/client.rb:467:in
`client_request'
from (eval):3:in `list_queues'
from
/Users/mingming/.rvm/gems/ruby-1.9.3-p429@gemset193/gems/aws-sdk-1.19.0/lib/aws/sqs/queue_collection.rb:171:in
`_each_item'
from
/Users/mingming/.rvm/gems/ruby-1.9.3-p429@gemset193/gems/aws-sdk-1.19.0/lib/aws/core/collection/simple.rb:51:in
`_each_batch'
from
/Users/mingming/.rvm/gems/ruby-1.9.3-p429@gemset193/gems/aws-sdk-1.19.0/lib/aws/core/collection.rb:80:in
`each_batch'
from
/Users/mingming/.rvm/gems/ruby-1.9.3-p429@gemset193/gems/aws-sdk-1.19.0/lib/aws/core/collection.rb:47:in
`each'
from get_queue_list.rb:21:in `collect'
from get_queue_list.rb:21:in `<main>'
`
Thanks for providing your information, Keep Updates with us AWS Online Training
ReplyDelete