Sha256: 781102b3c2fb8c660e250a8348184bd3c2317e078929084ef3c39cee1dfc4438
Contents?: true
Size: 518 Bytes
Versions: 2
Compression:
Stored size: 518 Bytes
Contents
require 'open-uri' module Pec2 class Metadata class << self def get_document JSON.parse(get_metadata('/latest/dynamic/instance-identity/document/')) end 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pec2-0.7.1 | lib/pec2/metadata.rb |
pec2-0.7.0 | lib/pec2/metadata.rb |