X-Ray
AWS X-Ray
A service that traces where APIs and Lambda processes become slow.
In one sentence
A service that traces where APIs and Lambda processes become slow.
Overview
AWS X-Ray is a tracing service that visualizes request paths and processing times across distributed applications.
Common use cases
- Tracing serverless APIs
- Investigating latency in microservices
- Root cause analysis during incidents
CLF-C02 exam points
- A distributed tracing service
- Used to investigate performance issues
- Plays a different role than CloudWatch Logs
SAA-C03 exam points
- Integrates with API Gateway and Lambda
- Visualizes bottlenecks across services
- CloudWatch Logs is often sufficient in MVPs
Practical Use
AWS X-Ray is a distributed tracing service that visualizes the request paths and processing times of distributed applications. For serverless architectures such as API Gateway → Lambda → DynamoDB, or microservice architectures such as ALB → ECS → RDS, it records the path that a single request takes through each component, along with processing time (latency) and error information for each component. In the X-Ray console, the overall picture is visualized as a service map, and it becomes possible to track, on a per-request basis, which inter-service calls are slow and where errors are occurring. To enable X-Ray, either the X-Ray SDK must be integrated into the application code, or the X-Ray tracing feature of the target service must be enabled. Major services such as Lambda, API Gateway, ALB, SQS, and SNS can send data to X-Ray simply by enabling tracing in the console. When the SDK is integrated, custom subsegments (for external API calls, DB queries, and the like) can be recorded, allowing bottlenecks to be identified at a finer granularity. The sampling rate can be configured to control the proportion of requests captured as traces, helping to manage costs. It is important to organize the role differences with CloudWatch Logs. CloudWatch Logs aggregates text logs from individual services, while X-Ray visualizes the execution path and processing times of requests that span multiple services. During incident investigations, the two are commonly used together: X-Ray helps identify which segments are slow or failing, while CloudWatch Logs provides the detailed logs for the relevant segments. Pricing is based on the number of traces recorded and retrieved, with a fixed free tier each month. In CLF-C02, framings such as X-Ray as distributed tracing, its use for investigating latency in Lambda or API Gateway, and the difference in roles compared to CloudWatch Logs are frequent topics.
Official Documentation
Cost notes
- Billed by number of traces recorded and retrieved
- Not required when the service only exposes a contact API
Security notes
- Do not include personal information or message bodies in traces
- Restrict the data scope captured in production
Related services
Related comparison articles
Related architecture diagrams
Tags
Last updated: 2026-06-07
Previous term
AWS WAF