class AWS::EC2::ImageCollection

def create options = {}

Returns:
  • (Image) -

Options Hash: (**options)
  • :block_device_mappings (Hash) -- This must be a
  • :root_device_name (String) -- The root device
  • :ramdisk (Image) -- The ramdisk image to use.
  • :ramdisk_id (String) -- The ID of the RAM disk
  • :kernel (Image) -- The kernel image to use.
  • :kernel_id (String) -- The ID of the kernel to
  • :architecture (String) -- The architecture of
  • :image_location (String) -- Full path to your
  • :no_reboot (Boolean) -- By default this
  • :description (String) -- A description of the
  • :instance_id (String) -- The ID of a running

Parameters:
  • options (Hash) -- Options for creating the image.
def create options = {}
  resp = case
  when options[:instance_id]
    client.create_image(options)
  when options[:image_location] || options[:root_device_name]
    if kernel = options.delete(:kernel)
      options[:kernel_id] = kernel.id
    end
    if ramdisk = options.delete(:ramdisk)
      options[:ramdisk_id] = ramdisk.id
    end
    options[:block_device_mappings] =
      translate_block_device_mappings(options[:block_device_mappings]) if
      options[:block_device_mappings]
    client.register_image(options)
  else
    raise(ArgumentError,
          "expected instance_id, image_location, " +
          "or root_device_name")
  end
  Image.new(resp.image_id, :config => config)
end