Interview Prep/AWS/Route 53, CloudFront, API Gateway and Messaging

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 →

  1. Use a cache policy with a minimal key (for example, CachingOptimized for static paths)
  2. Forward the values the origin needs through an origin request policy, which does not affect the cache key
  3. Normalize or strip query strings, and set proper Cache-Control at the origin

Prevent → Use separate behaviors for /static/* and /api/*, and alarm on CacheHitRate (with additional metrics turned on).

aws All AWS questions Roadmap: AWS core services

More on Route 53, CloudFront, API Gateway and Messaging