AWS › Amazon CloudFront & Content Delivery
How does caching work in CloudFront, and how do you control how long content stays cached?
IntermediateAnswer
CloudFront caches content at edge locations based on cache behaviors you configure, including a time to live value that controls how long an object is kept before CloudFront checks the origin again for a fresh copy, and you can also control caching using HTTP headers like Cache Control sent directly from your origin server.
aws cloudfront create-invalidation --distribution-id ABC123 --paths '/images/*'Real-world example An e commerce site sets a long cache duration for rarely changing product images but a very short cache duration for its frequently updated pricing page, balancing performance with data freshness.