CloudFront cache hit ratio is under 20% and origin load is high, even for static content.
AdvancedTroubleshootingRoute 53, CloudFront, API Gateway and Messaging
Answer
Likely causes → The cache key includes high-cardinality values: all query strings (tracking parameters like utm_*), all cookies, or headers like User-Agent or Authorization. Legacy "forward all" settings split the cache. Short TTLs or Cache-Control: no-store from the origin also prevent caching.
Diagnose →
aws cloudfront get-distribution-config --id E123ABC \
--query 'DistributionConfig.DefaultCacheBehavior.[CachePolicyId,OriginRequestPolicyId,ForwardedValues]'
aws cloudfront get-cache-policy --id <policy-id>
# CloudFront standard logs / real-time logs: x-edge-result-type Miss vs Hit, by URI
Fix →
- Use a cache policy with a minimal key (for example,
CachingOptimizedfor static paths) - Forward the values the origin needs through an origin request policy, which does not affect the cache key
- Normalize or strip query strings, and set proper
Cache-Controlat the origin
Prevent → Use separate behaviors for /static/* and /api/*, and alarm on CacheHitRate (with additional metrics turned on).
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