How to enable AWS X-Ray tracing for EC2 microservices?

A developer has written a distributed application that uses microservices. The microservices are running on Amazon EC2 instances. Because of message volume, the developer is unable to match log output from each microservice to a specific transaction. The developer needs to analyze the message flow to debug the application. Which combination of steps should the developer take to meet this requirement? (Choose two.)

  1. Download the AWS X-Ray daemon. Install the daemon on an EC2 instance. Ensure that the EC2 instance allows UDP traffic on port 2000. Source Reference Answer
  2. Configure an interface VPC endpoint to allow traffic to reach the global AWS X-Ray daemon on TCP port 2000.
  3. Enable AWS X-Ray. Configure Amazon CloudWatch to push logs to X-Ray.
  4. Add the AWS X-Ray software development kit (SDK) to the microservices. Use X-Ray to trace requests that each microservice makes. Source Reference Answer
  5. Set up Amazon CloudWatch metric streams to collect streaming data from the microservices.

Community Votes

AD
100%

100% of anonymous learners picked answer AD. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

This question tests the specific architecture of AWS X-Ray on EC2, requiring both the SDK for instrumentation and the Daemon for data relay, which differs from managed services like Lambda.

To analyze message flow and correlate logs in distributed EC2 microservices, developers must implement AWS X-Ray. This requires installing the X-Ray daemon on the EC2 instances and integrating the X-Ray SDK into the application code.

Selecting option C is a common error because users often confuse CloudWatch Logs integration with the core mechanism of X-Ray tracing, which relies on the SDK and Daemon rather than log pushing.

Community Discussion (3 comments)

preachr 👍 1 Selected: AD
The AWS X-Ray daemon is a software application that listens for traffic on UDP port 2000, gathers raw segment data, and relays it to the AWS X-Ray API. The daemon works in conjunction with the AWS X-Ray SDKs and must be running so that data sent by the SDKs can reach the X-Ray service.
KennethNg923 👍 2 Selected: AD
A. The X-Ray daemon is necessary for collecting trace data from the EC2 instances running the microservices. It needs to be installed on each EC2 instance, and UDP port 2000 should be open for the daemon to communicate with the X-Ray service. D. Adding the X-Ray SDK to the microservices allows you to instrument your application code to send trace data to X-Ray. This is crucial for tracing requests across different microservices.
rdiaz 👍 1 Selected: AD
AD are the best of the options provided

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Option D is correct because adding the AWS X-Ray SDK to the microservices is the primary method to instrument the application code, allowing it to send trace data segments for incoming and outgoing requests. Option A is correct because the X-Ray daemon must be installed on EC2 instances to listen for this trace data on UDP port 2000 and relay it to the AWS X-Ray API, which is necessary since EC2 does not provide a managed runtime environment like AWS Lambda does. Together, these steps create a service map that visualizes the message flow and correlates specific transactions across microservices.

Why the Other Options Are Wrong

Option B is incorrect because the X-Ray daemon communicates with the AWS X-Ray service over HTTPS (TCP 443), not TCP 2000, and while VPC endpoints can be used, the description of a "global daemon" on TCP 2000 is technically inaccurate regarding the daemon's role. Option C is incorrect because CloudWatch does not push logs to X-Ray to generate traces; traces are generated by the SDK, though logs can be linked manually via Trace IDs. Option E is incorrect because CloudWatch metric streams deal with metric data aggregation, not the specific transaction tracing or message flow analysis required for debugging distributed systems.

Community Comment Notes

Community comments strongly support the combination of A and D, highlighting the specific role of the daemon in gathering raw segment data and the SDK's role in instrumentation. Commenters emphasize that the daemon listens on UDP port 2000 locally, reinforcing the validity of option A and clarifying the communication flow between the application, the daemon, and the cloud service.

Official Reference

Exam Strategy

When asked about tracing on EC2, remember the "SDK + Daemon" pattern. Unlike Lambda or ECS, which have managed integrations, EC2 requires you to manually install the daemon to handle the communication to the X-Ray backend.

Related Analysis

Practice All DVA-C02 Questions

Access 100 questions with complete answers and detailed explanations.

View Full DVA-C02 Practice Test →

← Back to DVA-C02 Study Guide