class Aws::AssumeRoleCredentials

constructed.
If you omit ‘:client` option, a new {STS::Client} object will be
ec2 = Aws::EC2::Client.new(credentials: role_credentials)
)
role_session_name: “session-name”
role_arn: “linked::account::arn”,
client: Aws::STS::Client.new(…),
role_credentials = Aws::AssumeRoleCredentials.new(
a role via {Aws::STS::Client#assume_role}.
An auto-refreshing credential provider that works by assuming

def initialize(options = {})

Options Hash: (**opitons)
  • :client (STS::Client) --
  • :external_id (String) --
  • :duration_seconds (Integer) --
  • :policy (String) --
  • :role_session_name (required, String) --
  • :role_arn (required, String) --
def initialize(options = {})
  @options = options.dup
  @client = @options.delete(:client) || STS::Client.new
  super
end

def refresh

def refresh
  creds = @client.assume_role(@options).credentials
  @access_key_id = creds.access_key_id
  @secret_access_key = creds.secret_access_key
  @session_token = creds.session_token
  @expiration = creds.expiration
end