Question

Difficulty: EasyInstrumenting Distributed Tracing with AWS X-Ray

A developer has deployed a Python web application on an Amazon EC2 instance. The developer wants to use AWS X-Ray to trace incoming HTTP requests and downstream AWS service calls. Which two actions must the developer take to instrument the application and successfully send trace data to X-Ray? (Select TWO.)

  1. Install and run the AWS X-Ray daemon on the Amazon EC2 instance to collect and upload trace data.Answer
  2. Use the AWS X-Ray SDK to patch supported libraries in the Python code to record outgoing HTTP and AWS SDK calls.Answer
  3. C
    Initialize the AWS SDK clients by hardcoding an IAM user's access keys that have permissions to write trace segments.
  4. D
    Rely solely on enabling active tracing in the EC2 console, which automatically instruments the application code without SDK configuration.
  5. E
    Configure a custom execution timeout on the Amazon EC2 instance configuration to allow the Lambda environment to flush trace segments.

Answer

Install and run the AWS X-Ray daemon on the Amazon EC2 instance to collect and upload trace data, and use the AWS X-Ray SDK to patch supported libraries in the Python code to record outgoing HTTP and AWS SDK calls.
For an application hosted on an Amazon EC2 instance to use AWS X-Ray, the host must run the X-Ray daemon to collect and forward trace segment documents to the AWS X-Ray API. Additionally, the application code must use the AWS X-Ray SDK to patch outgoing libraries (such as boto3) to capture downstream context and API calls.

Step-by-Step Solution

1
Deploy and execute the AWS X-Ray daemon on the EC2 instance.
The daemon starts running and listens on UDP port 2000 to collect trace data segments.
EC2 is an unmanaged hosting environment, so the X-Ray daemon must be manually run to aggregate and upload trace data.
2
Use the AWS X-Ray SDK in the Python code to patch libraries like boto3.
The SDK automatically intercepts outgoing calls and generates trace segments.
Explicit patching or instrumentation is required in Python code to automatically propagate tracking IDs and capture metadata for downstream dependencies.

Key Concept

To enable X-Ray tracing on Amazon EC2, the developer must manually install and run the X-Ray daemon and instrument the application code using the X-Ray SDK.
Rate this question