Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add support for Temporary Security Tokens #131

Closed
wants to merge 1 commit into from

2 participants

@pieter

This has become more useful now that you can assign roles to EC2 instances.

This simple patch adds a SecurityToken field to requests if the Ec2 object has been
initialized with a :token parameter.

See http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/UsingIAM.html#UsingIAMrolesWithAmazonEC2Instances

@konstantin-dzreev
Collaborator

merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 0 deletions.
  1. +1 −0  lib/awsbase/right_awsbase.rb
  2. +1 −0  lib/ec2/right_ec2.rb
View
1  lib/awsbase/right_awsbase.rb
@@ -448,6 +448,7 @@ def generate_request_impl(verb, action, options={}, custom_options={}) #:nodoc:
"AWSAccessKeyId" => @aws_access_key_id,
"Version" => custom_options[:api_version] || @params[:api_version] }
service_hash.merge!(options)
+ service_hash["SecurityToken"] = @params[:token] if @params[:token]
# Sign request options
service_params = signed_service_params(@aws_secret_access_key, service_hash, http_verb, @params[:host_to_sign], @params[:service])
# Use POST if the length of the query string is too large
View
1  lib/ec2/right_ec2.rb
@@ -120,6 +120,7 @@ def self.api
# * <tt>:logger</tt>: for log messages, default: RAILS_DEFAULT_LOGGER else STDOUT
# * <tt>:signature_version</tt>: The signature version : '0','1' or '2'(default)
# * <tt>:cache</tt>: true/false: caching for: ec2_describe_images, describe_instances,
+ # * <tt>:token</tt>: Option SecurityToken for temporary credentials
# describe_images_by_owner, describe_images_by_executable_by, describe_availability_zones,
# describe_security_groups, describe_key_pairs, describe_addresses,
# describe_volumes, describe_snapshots methods, default: false.
Something went wrong with that request. Please try again.