A REST API returns `{"message":"Forbidden"}` (403) to a client that sends the right path.
IntermediateTroubleshootingRoute 53, CloudFront, API Gateway and Messaging
Answer
Likely causes → The method requires an API key and the x-api-key header is missing, or the key is not in a usage plan tied to this stage. For a private API, the call does not come through the allowed VPC endpoint, or the resource policy denies it. A WAF rule may also block it.
Diagnose →
aws apigateway get-method --rest-api-id abc123 --resource-id res1 --http-method GET --query apiKeyRequired
aws apigateway get-usage-plans --query 'items[].[name,apiStages]'
aws apigateway get-rest-api --rest-api-id abc123 --query '[endpointConfiguration,policy]'
Fix →
- Send
x-api-key, and link the key to a usage plan with this stage:aws apigateway create-usage-plan-key --usage-plan-id up1 --key-id k1 --key-type API_KEY - For private APIs, call through the execute-api VPC endpoint and allow
aws:SourceVpcein the resource policy
Prevent → Do not use API keys as authentication (use IAM, Cognito or JWT authorizers), and turn on access logging with $context.error.responseType.
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