Sha256: 8f636bb91b14a86aaa080e3c92f061f1541034710b218b825ea230c30a1d8d9a

Contents?: true

Size: 583 Bytes

Versions: 4

Compression:

Stored size: 583 Bytes

Contents

require 'eat'

module EY
  class Metadata
    # An adapter that reads from Amazon EC2's metadata web service, which is only available from cloud instances.
    class AmazonEc2Api
      # The present instance's Amazon Ec2 instance id.
      def present_instance_id
        @present_instance_id ||= eat 'http://169.254.169.254/latest/meta-data/instance-id'
      end

      # The present instance's Amazon Ec2 security group.
      def present_security_group
        @present_security_group ||= eat 'http://169.254.169.254/latest/meta-data/security-groups'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
engineyard-metadata-0.2.3 lib/engineyard-metadata/amazon_ec2_api.rb
engineyard-metadata-0.2.2 lib/engineyard-metadata/amazon_ec2_api.rb
engineyard-metadata-0.2.1 lib/engineyard-metadata/amazon_ec2_api.rb
engineyard-metadata-0.2.0 lib/engineyard-metadata/amazon_ec2_api.rb