Search code examples
amazon-web-servicesamazon-cloudfront

CloudFront atomic replication


I want to host a static site via Amazon CloudFront from an S3 bucket. If I update the content of the bucket with a new version of the page, is there a way I can ensure the distribution happens in an atomic way?

What I mean is, if I have assets like a.js and b.js, that the updated version of both is served at the same time, and not e.g. the old a.js and new b.js.


Solution

  • You have a couple of options:

    1. You can request an invalidation. Takes about 15 minutes or so to complete.
    2. You can give your new assets a new name. This is a bit harder to do, but in my opinion the preferable route. Since its easier to enable long expiration client side caching.