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

After deploying a new frontend build, users still see the old JavaScript for hours.

BeginnerTroubleshootingRoute 53, CloudFront, API Gateway and Messaging
Answer

Likely causes → CloudFront (and browsers) cache the objects for the TTL set by the cache policy or by Cache-Control headers. Files with the same name, such as app.js and index.html, are not refetched.

Diagnose →

curl -sI https://www.example.com/app.js | grep -iE 'x-cache|age|cache-control|etag'
aws cloudfront list-invalidations --distribution-id E123ABC --max-items 3

Fix →

aws cloudfront create-invalidation --distribution-id E123ABC --paths "/index.html" "/app.js"

Prevent → Use content-hashed asset names (app.3f9c2.js) with long TTLs and immutable. Give index.html Cache-Control: no-cache (or a short TTL), and invalidate only index.html on deploy.

aws All AWS questions Roadmap: AWS core services

More on Route 53, CloudFront, API Gateway and Messaging