November 20, 2018 in General Questions
Can I use my S3 Cloudfront distribution to serve all content and assets if Content Management is set to an S3 Bucket?
Thank you for any insights and attention!
Yes, just can define S3 for all file storages and then use a CDN of your choice such as Cloudfront.
Our CiC offering uses S3 and Cloudfront (automatically, you don't have to set anything up yourself). So the answer is yes, it's supported.
On the software side, you just have to plug in the appropriate CDN URL base in the file storage configuration.
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.
@The Old Man Hi, I'm just in the process of going through this now, could you share recommendations on what I should use as default? Cheers
This topic is now archived and is closed to further replies.
Started Wednesday at 04:44 PM
Started Saturday at 09:46 AM
Started Friday at 06:03 PM