Class: Pec2::Metadata
- Inherits:
-
Object
- Object
- Pec2::Metadata
- Defined in:
- lib/pec2/metadata.rb
Class Method Summary collapse
Class Method Details
.get_document ⇒ Object
6 7 8 |
# File 'lib/pec2/metadata.rb', line 6 def get_document JSON.parse(('/latest/dynamic/instance-identity/document/')) end |
.get_metadata(path) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/pec2/metadata.rb', line 10 def (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 |