I want to collect Amazon API Gateway extended request IDs.
Resolution
To collect extended request IDs, check access log records, execution log records, or HTTP response headers.
Configure logging
If you didn't set up logging for your API then see Configure logging for HTTP APIs in API Gateway and Set up CloudWatch logging for REST APIs in API Gateway.
Note: You must activate access logging to capture extended request IDs. Access logs might capture requests that fail to reach execution logging.
Check access log records
When you check your access log records, you can view who accessed your API and how. To get the request IDs in access logs, include the context.extendedRequestId context variable when you customize the content for your logs.
Check execution log records
You can check extended request IDs in execution logs that API Gateway manages.
Extended request IDs appear as one of the following formats:
- Log group format: API-Gateway-Execution-Logs_{rest-api-id}/{stage_name}
- Extended request ID format: "XxxXXXxx="
Check HTTP response headers
You can find extended request IDs in API response headers.
For example, you run the following curl command with the verbose flag (-v):
curl -v GET https://your-api-id.execute-api.region.amazonaws.com/stage/resource
You receive the following header in the response:
x-amz-apigw-id: XxxXXXxx=