Class: OpenStax::Aws::Ec2InstanceData
- Inherits:
-
Object
- Object
- OpenStax::Aws::Ec2InstanceData
- Defined in:
- lib/openstax/aws/ec2_instance_data.rb
Class Method Summary collapse
Class Method Details
.get(key) ⇒ Object
4 5 6 7 |
# File 'lib/openstax/aws/ec2_instance_data.rb', line 4 def self.get(key) endpoint = "http://169.254.169.254/latest/#{key}" Net::HTTP.get(URI.parse(endpoint)) end |
.instance_id ⇒ Object
9 10 11 |
# File 'lib/openstax/aws/ec2_instance_data.rb', line 9 def self.instance_id get("meta-data/instance-id") end |
.region ⇒ Object
13 14 15 |
# File 'lib/openstax/aws/ec2_instance_data.rb', line 13 def self.region get("meta-data/placement/availability-zone")[0..-2] end |