Method: AWS::Configuration#initialize

Defined in:
lib/aws/configuration.rb

#initialize(options = {}) ⇒ Configuration

Creates a new Configuration object.

Parameters:

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

Options Hash (options):

  • :access_key_id (String)

    Your account access key id credential.

  • :secret_access_key (String)

    Your account secret access key credential.

  • :max_retries (Integer) — default: 3

    The maximum number of times service errors (500) should be retried. There is an exponential backoff in between service request retries, so the more retries the longer it can take to fail.

  • :ec2_endpoint (String) — default: 'ec2.amazonaws.com'

    The service endpoint to use when communicating with Amazon EC2.

  • :http_handler (Object)

    The request/response handler for all service requests. The default handler uses HTTParty to send requests.

  • :logger (Object) — default: nil

    A logger instance that should receive log messages generated by service requets. A logger needs to respond to #log and must accept a severity (e.g. :info, :error, etc) and a string message.

  • :s3_endpoint (String) — default: 's3.amazonaws.com'

    The service endpoint to use when communicating with Amazon S3.

  • :simple_db_consistent_reads (Boolean) — default: false

    When true all read operations against SimpleDB will be consistent reads (slower).

  • :simple_db_endpoint (String) — default: 'sdb.amazonaws.com'

    The service endpoint to use when communicating with Amazon SimpleDB.

  • :simple_email_service_endpoint (String) — default: 'email.us-east-1.amazonaws.com'

    The service endpoint to use when communicating with Amazon SimpleEmailService.

  • :signer (Object)

    The request signer. Defaults to a DefaultSigner.

  • :sns_endpoint (String) — default: 'sns.us-east-1.amazonaws.com'

    The service endpoint to use when communicating with Amazon SNS.

  • :sqs_endpoint (String) — default: 'sqs.us-east-1.amazonaws.com'

    The service endpoint to use when communicating with Amazon SQS.

  • :stub_requests (Object) — default: false

    When true no requests will be made against the live service. Responses returned will have empty values. This is primarily used for writing tests.

  • :use_ssl (Boolean) — default: true

    When true, all requests are sent over SSL.

  • :ssl_verify_peer (Boolean) — default: true

    True if the HTTPS client should validate the server certificate. Note: This option should only be used for diagnostic purposes; leaving this option set to false exposes your application to man-in-the-middle attacks and can pose a serious security risk.

  • :ssl_ca_file (String)

    The path to a CA cert bundle in PEM format. If :ssl_verify_peer is true (the default) this bundle will be used to validate the server certificate in each HTTPS request. The AWS SDK for Ruby ships with a CA cert bundle, which is the default value for this option.

  • :user_agent_prefix (String) — default: nil

    A string prefix to append to all requets against AWS services. This should be set for clients and applications built ontop of the aws-sdk gem.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/aws/configuration.rb', line 63

def initialize options = {}

  @create_options = options.delete(:__create_options__) || {}

  @overridden = options.delete(:__overridden__) ||
    Set.new(options.keys.map { |k| k.to_sym })

  @options = {
    :ec2_endpoint => 'ec2.amazonaws.com',
    :http_handler => Http::HTTPartyHandler.new,
    :max_retries => 3,
    :s3_endpoint => 's3.amazonaws.com',
    :s3_multipart_threshold => 16 * 1024 * 1024,
    :s3_multipart_min_part_size => 5 * 1024 * 1024,
    :s3_multipart_max_parts => 10000,
    :simple_db_endpoint => 'sdb.amazonaws.com',
    :simple_db_consistent_reads => false,
    :simple_email_service_endpoint => 'email.us-east-1.amazonaws.com',
    :sns_endpoint => 'sns.us-east-1.amazonaws.com',
    :sqs_endpoint => 'sqs.us-east-1.amazonaws.com',
    :stub_requests => false,
    :use_ssl => true,
    :user_agent_prefix => nil,
    :ssl_verify_peer => true,
    :ssl_ca_file => File.expand_path(File.dirname(__FILE__)+
                                     "/../../ca-bundle.crt")
  }

  {
    'AWS_ACCESS_KEY_ID'        => :access_key_id,
    'AWS_SECRET_ACCESS_KEY'    => :secret_access_key,
    'AMAZON_ACCESS_KEY_ID'     => :access_key_id,
    'AMAZON_SECRET_ACCESS_KEY' => :secret_access_key,
  }.each_pair do |env_key, opt_key|
    if ENV[env_key]
      @options[opt_key] = ENV[env_key]
    end
  end

  options.each do |(k,v)|
    @options[k.to_sym] = v
  end

end