AWS X-Ray

Distributed tracing service that follows a single request across every service it touches.

Verified against AWS documentation · 2026-08-27

Key facts

  1. 01Traces a request end-to-end: segments (per service) and subsegments (per downstream call) stitched into one trace
  2. 02Service map auto-draws your architecture from trace data — latency, errors, and throttles per node
  3. 03Sampling by default: first request each second + 5% of the rest, so you're not paying to trace everything
  4. 04Limits: 500 KB max trace size, 30-day trace retention, annotations are indexed/searchable but metadata is not

Exam triggers

Phrases and scenarios that point here.

  • "Trace requests across microservices", "find the bottleneck", "end-to-end latency" → X-Ray
  • "Which service in the chain is causing errors" → service map
  • Debugging Lambda or API Gateway latency across multiple hops → enable active tracing
  • Filter traces by business attribute (user ID, order ID) → annotations

Not this service

  • Metrics, alarms, or dashboards → CloudWatch
  • API call audit history (who did what) → CloudTrail
  • Application logs → CloudWatch Logs

Use cases

  1. 01A checkout request passes through API Gateway → Lambda → DynamoDB → SQS and takes 4 seconds; X-Ray shows the 3.5s is one throttled DynamoDB call, not the Lambda code
  2. 02New microservice deployed Friday; the service map lights up a node red Monday morning — you see the failing dependency without grepping a single log
  3. 03Tagging traces with an annotation like orderId so support can pull the exact trace for one customer's failed order
  4. 04Comparing p50 vs p99 latency per downstream hop to prove which team's service is dragging the SLA

How it's charged

  1. 01Billed on three dimensions: traces recorded, traces retrieved, traces scanned — recording costs ~10x more than retrieval/scanning
  2. 02Sampling is your cost lever: default sampling means bursty traffic doesn't linearly inflate the bill
  3. 03Perpetual free tier: 100,000 traces recorded + 1,000,000 retrieved/scanned per month
  4. 0430-day trace storage included — no separate storage charge
  5. 05X-Ray Insights, if enabled, bills per trace processed on top of recording

Commonly confused with

References