class Pec2::Metadata
Public Class Methods
get_document()
click to toggle source
# File lib/pec2/metadata.rb, line 6 def get_document JSON.parse(get_metadata('/latest/dynamic/instance-identity/document/')) end
get_metadata(path)
click to toggle source
# File lib/pec2/metadata.rb, line 10 def get_metadata(path) begin result = {} ::Timeout.timeout(TIME_OUT) { body = open('http://169.254.169.254' + path).read return body } return result rescue Timeout::Error => e raise "not EC2 instance" end end