Class: Awsum::Ec2::Image

Inherits:
Object show all
Defined in:
lib/awsum/ec2/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ec2, id, location, state, owner, public, architecture, type, kernel_id, ram_disk_id, platform, product_codes) ⇒ Image

:nodoc:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/awsum/ec2/image.rb', line 9

def initialize(ec2, id, location, state, owner, public, architecture, type, kernel_id, ram_disk_id, platform, product_codes) #:nodoc:
  @ec2 = ec2
  @id = id
  @location = location
  @state = state
  @owner = owner
  @public = public
  @architecture = architecture
  @type = type
  @kernel_id = kernel_id
  @ramdisk_id = ram_disk_id
  @platform = platform
  @product_codes = product_codes
end

Instance Attribute Details

#architectureObject (readonly)

Returns the value of attribute architecture.



7
8
9
# File 'lib/awsum/ec2/image.rb', line 7

def architecture
  @architecture
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/awsum/ec2/image.rb', line 7

def id
  @id
end

#kernel_idObject (readonly)

Returns the value of attribute kernel_id.



7
8
9
# File 'lib/awsum/ec2/image.rb', line 7

def kernel_id
  @kernel_id
end

#locationObject (readonly)

Returns the value of attribute location.



7
8
9
# File 'lib/awsum/ec2/image.rb', line 7

def location
  @location
end

#ownerObject (readonly)

Returns the value of attribute owner.



7
8
9
# File 'lib/awsum/ec2/image.rb', line 7

def owner
  @owner
end

#platformObject (readonly)

Returns the value of attribute platform.



7
8
9
# File 'lib/awsum/ec2/image.rb', line 7

def platform
  @platform
end

#product_codesObject (readonly)

Returns the value of attribute product_codes.



7
8
9
# File 'lib/awsum/ec2/image.rb', line 7

def product_codes
  @product_codes
end

#publicObject (readonly)

Returns the value of attribute public.



7
8
9
# File 'lib/awsum/ec2/image.rb', line 7

def public
  @public
end

#ramdisk_idObject (readonly)

Returns the value of attribute ramdisk_id.



7
8
9
# File 'lib/awsum/ec2/image.rb', line 7

def ramdisk_id
  @ramdisk_id
end

#stateObject (readonly)

Returns the value of attribute state.



7
8
9
# File 'lib/awsum/ec2/image.rb', line 7

def state
  @state
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/awsum/ec2/image.rb', line 7

def type
  @type
end

Instance Method Details

#deregisterObject

Deregister this Image



29
30
31
# File 'lib/awsum/ec2/image.rb', line 29

def deregister
  @ec2.deregister_image @id
end

#public?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/awsum/ec2/image.rb', line 24

def public?
  @public
end

#reregisterObject

Reregister this image

Will both deregister and then register the Image again



36
37
38
39
40
41
# File 'lib/awsum/ec2/image.rb', line 36

def reregister
  @ec2.deregister_image @id
  new_id = @ec2.register_image @location
  @id = new_id
  self
end

#run(options = {}) ⇒ Object Also known as: launch

launches instances of this image

Options:

  • :min - The minimum number of instances to launch. Default: 1

  • :max - The maximum number of instances to launch. Default: 1

  • :key_name - The name of the key pair with which to launch instances

  • :security_groups - The names of security groups to associate launched instances with

  • :user_data - User data made available to instances (Note: Must be 16K or less, will be base64 encoded by Awsum)

  • :instance_type - The size of the instances to launch, can be one of [m1.small, m1.large, m1.xlarge, c1.medium, c1.xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cc1.4xlarge, cg1.4xlarge, t1.micro], default is m1.small

  • :availability_zone - The name of the availability zone to launch this instance in

  • :kernel_id - The ID of the kernel with which to launch instances

  • :ramdisk_id - The ID of the RAM disk with which to launch instances

  • :block_device_map - A ‘hash’ of mappings. E.g. => ‘sdb’



56
57
58
# File 'lib/awsum/ec2/image.rb', line 56

def run(options = {})
  @ec2.run_instances(id, options)
end