Skip to Content

AWS X-Ray

AWS X-Ray for distributed tracing, traces, segments and the trace map, sampling, the services it integrates with, and the move to OpenTelemetry.

Not in the course slides

AWS X-Ray is on the exam guide's in-scope list (and named in task 2.2) but not in the course slides. This page is written from the AWS documentation.

What it is

AWS X-Ray: a request passes through API Gateway, Lambda and DynamoDB; API Gateway and Lambda send trace segments to X-Ray, which builds a trace map showing the time spent in each service, here revealing a slow DynamoDB call AWS X-Ray: a request passes through API Gateway, Lambda and DynamoDB; API Gateway and Lambda send trace segments to X-Ray, which builds a trace map showing the time spent in each service, here revealing a slow DynamoDB call

Follow one request through every service.

AWS X-Ray gives distributed tracing: it follows each request through an application, across services, to show where time is spent and where errors happen.

In a microservices or serverless application, one click can call API Gateway, three Lambda functions, DynamoDB and an external API. Logs show each piece separately; X-Ray connects them.

  • Trace: the whole journey of one request, with a trace ID passed along in a tracing header.
  • Segments: the work done by each service (host, request, response, start and end times, errors). Subsegments break it down further, such as a call to DynamoDB or an HTTP API.
  • Trace map (service graph): a visual map of the services and their connections, with latency and error rates on each.
  • Sampling: X-Ray records a sample of requests (for example the first request each second and 5% of the rest), to keep cost and overhead low.
  • Annotations: key-value pairs added to traces, to search them (for example customer_id).

Integrations: Lambda (turn on active tracing), API Gateway, Elastic Beanstalk, ECS, EKS, EC2, SNS, SQS, Step Functions and more.

Updated since the slides

On 25 February 2026, the X-Ray SDKs and daemon entered maintenance mode (security fixes only). AWS now recommends instrumenting applications with OpenTelemetry (for example the AWS Distro for OpenTelemetry or the CloudWatch agent), which still sends traces to X-Ray. The service itself and the exam idea are unchanged.

Real-world examples

  • An e-commerce API is slow at checkout. The X-Ray trace map shows 90% of the time is spent in a call from Lambda to a third-party payment API.
  • A team filters traces by the annotation customer_id = 4711 to see exactly what happened to one customer's failed request.

Exam tips

  • "Trace requests across microservices", "find the bottleneck", "service map", "debug distributed applications" → AWS X-Ray.
  • "Troubleshoot latency in a serverless application end to end" → X-Ray (with Lambda active tracing).

Common traps

  • "CloudTrail traces application requests." CloudTrail records AWS API calls for auditing; X-Ray traces the application's requests.
  • "X-Ray records every request." It samples them.

Check yourself

AWS documentation

On this page

Open notes

Spotted a mistake?

These notes are open source. Suggest a fix, or star the repo if they helped you.

Suggest an edit

For AI agents: llms.txt · llms-full.txt