X-Amzn-RequestId
Tracing API calls across AWS managed services is the purpose of the X-Amzn-RequestId unofficial response header, which contains a unique identifier assigned to each request processed by API Gateway, Lambda, DynamoDB, and other AWS endpoints.
Usage
AWS services generate a unique request ID for every incoming API call and return the value in the X-Amzn-RequestId response header. The identifier provides a reference for tracing requests through AWS infrastructure and for opening support cases with AWS. The format varies by service.
The header appears in responses from a wide range of AWS services including API Gateway, Lambda, DynamoDB, SQS, SNS, and Cognito. Logging this value on the client side allows correlating application-level observations with AWS CloudWatch logs and CloudTrail entries, where the same request ID is recorded.
Note
AWS uses different request ID header names across
services. Amazon S3 returns X-Amz-Request-Id
(with a different capitalization and naming
pattern), while API Gateway and most other AWS
services return X-Amzn-RequestId. When API
Gateway proxies an upstream AWS service, the
upstream request ID is sometimes remapped into
X-Amzn-Remapped-X-Amzn-RequestId.
The header serves a similar purpose to X-Request-Id, which fulfills the same role in non-AWS environments.
Note
The "X-" naming convention for HTTP headers, "X" referring to "experimental", has been deprecated and needs to be transitioned to the formal naming convention for HTTP headers.
Values
Service-specific identifier
The value format depends on the service. API Gateway and Lambda return a UUID v4 string in the standard 8-4-4-4-12 hexadecimal format. DynamoDB returns an opaque uppercase string of around 52 characters in a base32-style alphabet. Each request produces a different identifier regardless of whether the request succeeds or fails. The value is opaque and carries no encoded metadata.
Example
A response from an AWS API Gateway endpoint includes the request identifier as a UUID. The value acts as a lookup key when searching CloudWatch logs or when filing an AWS support case.
X-Amzn-RequestId: 66b53bf4-73c1-486c-af83-18293d603e7f
Different requests to the same service produce distinct identifiers. A Lambda function invoked through API Gateway returns its own request ID.
X-Amzn-RequestId: bf7a7f68-27b8-4baf-9408-0c9a31ed1c38
DynamoDB responses carry the same header with a different format, an opaque uppercase string instead of a UUID.
X-Amzn-RequestId: 6VQMGM8I15TD18Q3F651NVO9Q3VV4KQNSO5AEMVJF66Q9ASUAAJG
When API Gateway proxies a request to another AWS service, the original request ID from the upstream service is remapped into a separate header. The response includes both the gateway's own request ID and the remapped upstream identifier.
X-Amzn-RequestId: cb79e005-acfe-49d5-a88c-d037d497f1d6
X-Amzn-Remapped-X-Amzn-RequestId: f2de7cc6-b57c-438e-a736-e15d31025acf