Method: CloudMaker::EC2#initialize

Defined in:
lib/cloud_maker/ec2.rb

#initialize(options) ⇒ EC2

Public: Creates a new EC2 instance

cloud_maker_config - A CloudMaker::Config object describing the instance

to be managed.

options - S3 configuration options

:aws_access_key_id     - (required) The AWS access key
:aws_secret_access_key - (required) The AWS secret

Returns a new CloudMaker::EC2 instance Raises RuntimeError if any of the required options are not specified



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/cloud_maker/ec2.rb', line 62

def initialize(options)
  required_keys = [:aws_access_key_id, :aws_secret_access_key]
  unless (required_keys - options.keys).empty?
    raise RuntimeError.new("Instantiated #{self.class} without required attributes: #{required_keys - options.keys}.")
  end

  self.aws_access_key_id = options[:aws_access_key_id]
  self.aws_secret_access_key = options[:aws_secret_access_key]

  self.ec2 = AWS::EC2.new(:access_key_id => self.aws_access_key_id, :secret_access_key => self.aws_secret_access_key)
end