Class: Cliaws::Ec2
- Inherits:
-
Object
- Object
- Cliaws::Ec2
- Defined in:
- lib/cliaws/ec2.rb
Defined Under Namespace
Classes: Instance
Instance Method Summary collapse
- #allocate_address ⇒ Object
- #associate_address(options) ⇒ Object
- #deallocate_address(address) ⇒ Object
- #describe_addresses ⇒ Object
- #disassociate_address(address) ⇒ Object
-
#initialize(access_key_id, secret_access_key) ⇒ Ec2
constructor
A new instance of Ec2.
- #list ⇒ Object
- #run(ami, options = {}) ⇒ Object
- #terminate(instance_ids) ⇒ Object
Constructor Details
#initialize(access_key_id, secret_access_key) ⇒ Ec2
Returns a new instance of Ec2.
8 9 10 |
# File 'lib/cliaws/ec2.rb', line 8 def initialize(access_key_id, secret_access_key) @access_key_id, @secret_access_key = access_key_id, secret_access_key end |
Instance Method Details
#allocate_address ⇒ Object
30 31 32 |
# File 'lib/cliaws/ec2.rb', line 30 def allocate_address ec2.allocate_address end |
#associate_address(options) ⇒ Object
38 39 40 |
# File 'lib/cliaws/ec2.rb', line 38 def associate_address() ec2.associate_address([:instance], [:address]) end |
#deallocate_address(address) ⇒ Object
34 35 36 |
# File 'lib/cliaws/ec2.rb', line 34 def deallocate_address(address) ec2.release_address(address) end |
#describe_addresses ⇒ Object
46 47 48 49 50 |
# File 'lib/cliaws/ec2.rb', line 46 def describe_addresses ec2.describe_addresses.inject([]) do |memo, hash| memo << {"instance_id" => hash[:instance_id], "address" => hash[:public_ip]} end end |
#disassociate_address(address) ⇒ Object
42 43 44 |
# File 'lib/cliaws/ec2.rb', line 42 def disassociate_address(address) ec2.disassociate_address(address) end |
#list ⇒ Object
12 13 14 |
# File 'lib/cliaws/ec2.rb', line 12 def list ec2.describe_instances.map {|raw_data| Instance.new(raw_data)} end |