API Gateway returns `504` with `{"message": "Endpoint request timed out"}` on long requests.
IntermediateTroubleshootingRoute 53, CloudFront, API Gateway and Messaging
Answer
Likely causes → The integration took longer than the integration timeout. The default is 29 seconds; for Regional and private REST APIs it can be raised with a quota increase, which may lower throttle limits.
Diagnose →
aws apigateway get-integration --rest-api-id abc123 --resource-id res1 --http-method POST --query timeoutInMillis
aws cloudwatch get-metric-statistics --namespace AWS/ApiGateway --metric-name IntegrationLatency \
--dimensions Name=ApiName,Value=orders --extended-statistics p99 --period 60 \
--start-time $(date -u -d '-1 hour' +%FT%TZ) --end-time $(date -u +%FT%TZ)
Fix →
- Make the long work asynchronous: the API puts a job on SQS or Step Functions and returns
202with a job ID, and the client polls or gets a callback - Optimize the backend call
Prevent → Design APIs so every synchronous call finishes in a few seconds.
More on Route 53, CloudFront, API Gateway and Messaging
You created a public hosted zone and records for `example.com`, but `dig example.com` returns `NXDOMAIN` or old records.Beginner`InvalidChangeBatch: RRSet of type CNAME with DNS name example.com. is not permitted at apex in zone example.com.`BeginnerThe primary Region is down, but Route 53 failover records still send traffic to it.IntermediateA Route 53 health check reports `Failure: Connection timed out` for an endpoint that works fine from your laptop.IntermediateYou changed an A record an hour ago, but some users still reach the old server, and a newly created name returned `NXDOMAIN` for a while.AdvancedCloudFront returns `403 AccessDenied` (S3 XML) for every object after you switched the S3 origin to Origin Access Control.Intermediate