Skip to content

Commit

Permalink
Adding details about IMDSv2 for docs purpose (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
srprash authored Apr 27, 2021
1 parent c3d89c8 commit edf5374
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 0 additions & 2 deletions lib/aws-xray-sdk/facets/net_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ def xray_sampling_request?(req)
req.path && (req.path == ('/GetSamplingRules') || req.path == ('/SamplingTargets'))
end

# Instance Metadata Service provides endpoint 169.254.169.254 to
# provide EC2 metadata
def ec2_metadata_request?(req)
req.uri && req.uri.hostname == '169.254.169.254'
end
Expand Down
4 changes: 3 additions & 1 deletion lib/aws-xray-sdk/plugins/ec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
module XRay
module Plugins
# A plugin that gets the EC2 instance_id, availabiity_zone, instance_type, and ami_id if running on an EC2 instance.
# The plugin queries IMDSv2 endpoint with X-aws-ec2-metadata-token-ttl-seconds as 60 seconds, and fallback to using
# IMDSv1 endpoint.
# More details about EC2 instance metadata retreival: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html#instancedata-data-retrieval
module EC2
include Logging

ORIGIN = 'AWS::EC2::Instance'.freeze

# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html#instancedata-data-retrieval
METADATA_BASE_URL = 'http://169.254.169.254/latest'.freeze

def self.aws
Expand Down

0 comments on commit edf5374

Please sign in to comment.