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 →
- Build with content hashes like
app.3f9a1c.jsand long TTLCache-Control: max-age=31536000, immutable - Keep
index.htmlat short TTL - Invalidate:
aws cloudfront create-invalidation --distribution-id E123 --paths /index.html - 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.
More on Route 53, CloudFront and Messaging
You want users routed to the nearest healthy region. Which Route 53 policy do you use?BeginnerPrimary region fails; how do you fail over DNS in a controlled way?IntermediateWhat is the difference between a CNAME and an alias record in Route 53?BeginnerRoll out a new version to 5 percent of users using DNS. How?IntermediateCloudFront returns 403 from an S3 origin. List the checks.IntermediateProtect an origin so that only CloudFront can reach your ALB.Advanced