How to enable AWS X-Ray tracing for EC2 microservices?
Short answer
AD Download the AWS X-Ray daemon. Install the daemon on an EC2 instance. Ensure that the EC2 instance allows UDP traffic on port 2000. Add the AWS X-Ray software development kit (SDK) to the microservices. Use X-Ray to trace requests that each microservice makes.
Question
Key Takeaways
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.
Common mistake: 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.
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
- https://docs.aws.amazon.com/xray/latest/devguide/xray-daemon.html
- https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-tracing
These links open the official vendor documentation in a new tab.
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.
Community Votes
100% of anonymous learners picked answer AD. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 3 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 3
-
KennethNg923 👍 2A. 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.
-
preachr 👍 1The 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.
-
rdiaz 👍 1AD are the best of the options provided
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →