Interview Prep/AWS/Route 53, CloudFront and Messaging

CloudFront serves stale content after you deployed a new JS bundle. How do you handle cache correctly?

IntermediateScenarioRoute 53, CloudFront and Messaging
Answer

Situation read → Hash filenames for assets and invalidate only the entry HTML.

What I'd do →

  1. Build with content hashes like app.3f9a1c.js and long TTL Cache-Control: max-age=31536000, immutable
  2. Keep index.html at short TTL
  3. Invalidate: aws cloudfront create-invalidation --distribution-id E123 --paths /index.html
  4. Use a cache policy rather than legacy settings

Why → Versioned filenames avoid invalidations, which are slow and cost beyond the free quota.

Interview tip → Mention first 1,000 paths per month are free.

aws All AWS questions Roadmap: AWS core services

More on Route 53, CloudFront and Messaging