Class: AWS::Core::CredentialProviders::EC2Provider

Inherits:
Object
  • Object
show all
Includes:
Provider
Defined in:
lib/aws/core/credential_providers.rb

Overview

This credential provider tries to get credentials from the EC2 metadata service.

Constant Summary

Constants included from Provider

Provider::KEYS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Provider

#access_key_id, #credentials, #refresh, #secret_access_key, #session_token

Constructor Details

#initialize(options = {}) ⇒ EC2Provider

Returns a new instance of EC2Provider.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :ip_address (String) — default: '169.254.169.254'
  • :port (Integer) — default: 80
  • :http_open_timeout (Float) — default: 1
  • :http_read_timeout (Float) — default: 1
  • :http_debug_output (Object) — default: nil

    HTTP wire traces are sent to this object. You can specify something like $stdout.



226
227
228
229
230
231
232
# File 'lib/aws/core/credential_providers.rb', line 226

def initialize options = {}
  @ip_address = options[:ip_address] || '169.254.169.254'
  @port = options[:port] || 80
  @http_open_timeout = options[:http_open_timeout] || 1
  @http_read_timeout = options[:http_read_timeout] || 1
  @http_debug_output = options[:http_debug_output]
end

Instance Attribute Details

#http_debug_outputObject?

Returns:

  • (Object, nil)


247
248
249
# File 'lib/aws/core/credential_providers.rb', line 247

def http_debug_output
  @http_debug_output
end

#http_open_timeoutFloat

Returns:

  • (Float)


241
242
243
# File 'lib/aws/core/credential_providers.rb', line 241

def http_open_timeout
  @http_open_timeout
end

#http_read_timeoutFloat

Returns:

  • (Float)


244
245
246
# File 'lib/aws/core/credential_providers.rb', line 244

def http_read_timeout
  @http_read_timeout
end

#ip_addressString

Returns Defaults to ‘169.254.169.254’.

Returns:

  • (String)

    Defaults to ‘169.254.169.254’.



235
236
237
# File 'lib/aws/core/credential_providers.rb', line 235

def ip_address
  @ip_address
end

#portInteger

Returns Defaults to port 80.

Returns:

  • (Integer)

    Defaults to port 80.



238
239
240
# File 'lib/aws/core/credential_providers.rb', line 238

def port
  @port
end