This file is indexed.

/usr/lib/python2.7/dist-packages/aws_xray_sdk/core/plugins/ec2_plugin.py is in python-aws-xray-sdk 0.95-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import logging
import requests

log = logging.getLogger(__name__)

SERVICE_NAME = 'ec2'
ORIGIN = 'AWS::EC2::Instance'


def initialize():
    """
    Try to get EC2 instance-id and AZ if running on EC2
    by querying http://169.254.169.254/latest/meta-data/.
    If not continue.
    """
    global runtime_context

    try:
        runtime_context = {}

        r = requests.get('http://169.254.169.254/latest/meta-data/instance-id', timeout=1)
        runtime_context['instance_id'] = r.text

        r = requests.get('http://169.254.169.254/latest/meta-data/placement/availability-zone', timeout=1)
        runtime_context['availability_zone'] = r.text

    except Exception:
        runtime_context = None
        log.warning("failed to get ec2 instance metadata.")