Sha256: 6be3b874cb440e7178105ff341e73c49dc22dd3ec6e95981cede11bd8e921c96

Contents?: true

Size: 436 Bytes

Versions: 4

Compression:

Stored size: 436 Bytes

Contents

require 'open-uri'

module EY
  module Metadata
    class AmazonEc2Api
      # The present instance's Amazon Ec2 instance id.
      def present_instance_id
        open("http://169.254.169.254/latest/meta-data/instance-id").gets
      end

      # The present instance's Amazon Ec2 security group.
      def present_security_group
        open('http://169.254.169.254/latest/meta-data/security-groups').gets
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
engineyard-metadata-0.0.4 lib/engineyard-metadata/amazon_ec2_api.rb
engineyard-metadata-0.0.3 lib/engineyard-metadata/amazon_ec2_api.rb
engineyard-metadata-0.0.2 lib/engineyard-metadata/amazon_ec2_api.rb
engineyard-metadata-0.0.1 lib/engineyard-metadata/amazon_ec2_api.rb