Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error "The security token included in the request is invalid" when using AWS ruby sdk

I'm getting this error "The security token included in the request is invalid" when trying to get hosted zones list from Route53 using AWS Ruby SDK, eventhough I'm running my script from instance having "full privileges" IAM role. Here is the full trace :

/usr/lib/ruby/gems/1.8/gems/aws-sdk-1.6.9/lib/aws/core/client.rb:318:in `return_or_raise': The security token included in the request is invalid (AWS::Route53::Errors::InvalidClientTokenId)
  from /usr/lib/ruby/gems/1.8/gems/aws-sdk-1.6.9/lib/aws/core/client.rb:419:in `client_request'
  from (eval):3:in `list_hosted_zones'
  from test.rb:7

And the test.rb file :

require 'rubygems'
require 'aws-sdk'

AWS.config()

r53 = AWS::Route53.new
resp = r53.client.list_hosted_zones
resp[:hosted_zones].each do |zone|
  puts zone
end

It seems that the issue is related to Route53 sdk methods, because I've tested with another code to manage EC2 and Elastic Load Balancers with same SDK and it's working just fine.

What do you think ? Did I missed something ? Thank you !

like image 579
PapelPincel Avatar asked Nov 30 '25 18:11

PapelPincel


1 Answers

There was a bug in the signature version 3 https signer that omitted the session token from the request. A new release was published today (1.7.1) that addressed this issue.

like image 101
Trevor Rowe Avatar answered Dec 03 '25 14:12

Trevor Rowe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!