0

I Have a file in CDN and I need a local copy of it in all of my EC2 instances. I like to set a TTL on the local copy of 5 minute, and have one of the following:

  1. Have it Fetch automatically as soon as the TTL expires.
  2. Have it delete automatically, and next time I want the file if it doesn't exist I fetch it.

I need to access the file probably more than once a minute, so I'm thinking #1 is a better option.

What are some technologies I can use either open source or AWS to have a TTL on a file and achieve the above? Are there any other suggestions about my design?

mina d
  • 105
  • 1
  • 3
  • Have you tried Amazon CloudFront with cache control headers? That said, why do you need something in CDN that's being requested somewhere around "once a minute" and only living for five. Surely that's not enough load to add complexity with? – ceejayoz Sep 16 '14 at 03:45
  • I have a policy file already in a CDN that gets updated few time s day but I don't know when. So I want to fetch it every five minute so that i know I have the latest one when I use it. I use it actually at least once a minute. – mina d Sep 16 '14 at 06:01

1 Answers1

3

Better way to do it to use script and check the TTL value of file on CDN file or if you know the exact TTL expiration time then you can fetch it using script.

Also it's better to only fetch when there was an update on the page which you are fetching else it is just simply downloading the same page again an again.

You may write a script to check last modified value in header and then download if page is being updated every five mins. Run Cron every 5 mins and this will keep checking it.

Pratap
  • 695
  • 6
  • 22