Module: EC2M

Extended by:
EC2M
Included in:
EC2M
Defined in:
lib/ec2meta.rb

Constant Summary collapse

VERSION =
'0.1'
API_VERSION =
'2009-04-04'
COMMANDS =
%w(ami_id ami_launch_index ami_manifest_path hostname
instance_action instance_id instance_type kernel_id
local_hostname local_ipv4 public_hostname public_ipv4
ramdisk_id reservation_id)

Instance Method Summary collapse

Instance Method Details

#ancestor_ami_idsObject



23
24
25
# File 'lib/ec2meta.rb', line 23

def ancestor_ami_ids
  get('ancestor-ami-ids').split
end

#availability_zoneObject



27
28
29
# File 'lib/ec2meta.rb', line 27

def availability_zone
  get 'placement/availability-zone'
end

#block_device_mapping(device = nil) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/ec2meta.rb', line 31

def block_device_mapping device=nil
  if device
    get "block-device-mapping/#{device}"
  else
    get('block-device-mapping/').split
  end
end

#get(name) ⇒ Object



9
10
11
12
# File 'lib/ec2meta.rb', line 9

def get name
  path = [API_VERSION, 'meta-data', name].join '/'
  Net::HTTP.get '169.254.169.254', path
end

#public_keysObject



39
40
41
# File 'lib/ec2meta.rb', line 39

def public_keys
  raise "Not implemented"
end