
AWS Edge Services - Troubleshooting
Troubleshoot issues helps you to quickly remediate errors that can happen at different part of your web application: CloudFront, edge functions, or the origin.
- CloudFront adds a x-amz-cf-id header that contains the request ID when it returns the response to an HTTP request.
- CloudFront include the request ID in the x-edge-request-id field of the log record generated for the request in access logs. If an AWS WAF WebACL is attached to the CloudFront distribution, the WAF includes the request ID in the requestId field of the log record generated for the request in WAF logs. For example, OLX built a chat bot that can be used by their customer support engineers in Slack to query a specific request by its rquest-ID from WAF logs to understand why they were blocked, and then respond faster to customer tickets on a daily basis.
- If an edge function is configured on the CloudFront distribution, the request ID is made available to the function in the requestId field in the event object, both for (CloudFront Functions, and Lambda@Edge).
- On caches misses, when CloudFront forwards the request to the origin, it appends the x-amz-cf-id header to the request, with the value of the request ID. It is recommended to log this header on your origin servers.
1
2
3
SELECT * AS count FROM cloudfront_logs
WHERE status >= 500 AND "date" BETWEEN DATE '2022-06-09' AND DATE '2022-06-10'
LIMIT 100;
- time-to-first-byte: First byte latency between CloudFront and the viewer, available in Standard logs and Real Time logs
- time-taken: last byte latency between CloudFront and the viewer, available in Standard logs and Real Time logs
- origin-fbl: first-byte latency between CloudFront and your origin, available in Real Time logs
- origin-lbl: last-byte latency between CloudFront and your origin, available in Real Time logs
- Blog: Four Steps for Debugging your Content Delivery on AWS. Note that while this blog is outdated, the methodology is still valid.
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.