Search code examples
javascriptamazon-web-servicesamazon-s3amazon-ec2amazon-cloudfront

Using a daily updated JSON file with AWS Cloudfront


Looking for the solution to get a Cloudfront CDN on a JSON file which is updated daily.

My AWS EC2 server is UK based. I generate a daily JSON file which is automatically sent to S3, as my app is aimed at Asia i am looking to use Cloudfront for speed at their end.

Is there a timed caching/refresh option with Cloudfront I can use with a daily file? The file is sent to S3 at 5am everyday.

I did try creating an invalidation, but it just deleted the cloudfront url access.


Solution

  • For this type of use case where you need high availability , frequently changing content , zero downtime And correct content at every hit... I will suggest setting cache-control metadata to 0

    Doing this cloud front will re-validate the content every time and load new content if it finds anything new.