Class: AWS::EC2::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/help/state_transition_helper.rb,
lib/audit/lib/ec2_utils.rb,
lib/help/ec2_helper.rb

Overview

Implements some helper methods around the EC2 API and methods that are not yet implemented in the amazon-ec2 gem

Instance Method Summary collapse

Instance Method Details

#describe_instance_attribute(options) ⇒ Object



7
8
9
10
11
12
# File 'lib/help/ec2_helper.rb', line 7

def describe_instance_attribute(options)
  params = {}
  params["InstanceId"] = options[:instance_id].to_s
  params["Attribute"] = "rootDeviceName" unless options[:attributes][:rootDeviceName] == nil
  return response_generator(:action => "DescribeInstanceAttribute", :params => params)
end

#get_console_output(options = {}) ⇒ Object

The GetConsoleOutput operation retrieves console output that has been posted for the specified instance.

Instance console output is buffered and posted shortly after instance boot, reboot and once the instance is terminated. Only the most recent 64 KB of posted output is available. Console output is available for at least 1 hour after the most recent post.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :instance_id (String) — default: ""

    an Instance ID

Raises:

  • (ArgumentError)


234
235
236
237
238
239
# File 'lib/audit/lib/ec2_utils.rb', line 234

def get_console_output( options = {} )
  options = {:instance_id => ""}.merge(options)
  raise ArgumentError, "No instance ID provided" if options[:instance_id].nil? || options[:instance_id].empty?
  params = { "InstanceId" => options[:instance_id] }
  return response_generator(:action => "GetConsoleOutput", :params => params)
end

#register_image_updated(options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/help/state_transition_helper.rb', line 15

def register_image_updated(options)
  puts "register_iamge_updated: #{options.inspect}"
  params = {}
  params["Name"] = options[:name].to_s
  params["BlockDeviceMapping.1.Ebs.SnapshotId"] = options[:snapshot_id].to_s
  params["BlockDeviceMapping.1.DeviceName"] = options[:root_device_name].to_s
  params["Description"] = options[:description].to_s
  params["KernelId"] = options[:kernel_id].to_s unless options[:kernel_id] == nil
  params["RamdiskId"] = options[:ramdisk_id].to_s unless options[:ramdisk_id] == nil
  params["Architecture"] = options[:architecture].to_s
  params["RootDeviceName"] = options[:root_device_name].to_s
  return response_generator(:action => "RegisterImage", :params => params)
end