Jump to content

Can Managed Content on AmazonS3 be served via Cloudfront Dis

James O'Malley

Recommended Posts

I've been using Cloudfront with S3 and Cloudflare for almost a year, I like it and yes it works but the real headache has always been how well it works I.e. the cache hit ratio, for months I was getting a poor hit rate of only 5%. If you use the default options, Cloudfront forwards every request to your S3 Origin (bucket) instead of caching them! Then you start adding Expiry headers in desperation to Objects etc because by default, the objects disappear from Edge Caches within hours whatever retention you set.

The pressure is now on to get caching much more efficient because for me the end of the free year is almost up and the monthly cost may jump a lot. Currently it's less than $10.

The documentation for AWS is very in-depth, but bizarrely doesn't simply tell you which settings and permissions you need to get a standard Cloudfront and S3 configuration working properly and effectively.

The logs are almost useless to say find a reason how and why a specific emoticon image disappeared. I found creating some widgets and graphs in Cloudwatch helped a lot.

The config options in the console suggest certain settings will improve caching, but then you read in the docs that's not actually the case, especially if you use Cors on the bucket. Or you read that you need to make objects public in order for the Cloudfront CDN to work and ignore all the public content warnings, until you discover that's either wrong or outdated. You restrict access to the bucket using an IAM and OAI, give them the access and you don't need to make anything public.

I've spent the last two months tweaking it and messing about trying to find out the best settings, it's a nightmare. I got it up to around 45%-55%. If there is a holy grail set of settings that can get you to 95% cache rate, I would recommend it be added to the IPS guidance page.

One thing to look out for is that files, images etc are transferred to S3 by IPS instead of being copied to S3. If and when they mysteriously disappear which used to happen a lot when I first set it up, they are easily gone forever. One way around that is to enable Versioning on the S3 bucket, so you at least have a chance to restore lost content. Don't take the risk and enable Versioning now!

Another thing to be aware of, is if you use S3 to store your theme files. Each time the support tool clears the cache, it uploads 100's of new files.

Link to comment
Share on other sites

  • 1 month later...


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...