Implementing CDN; Amazon S3 and CloudFront. What is the Best Approach?

I have implemented using Amazon S3 and used that for long. Before that I also tried with sub-domian of my own server. Then I used Cloudfront thinking it would be better. So, used Amazon S3 for as source and CloundFront for distribution from S3. For implementing this, I have moved uploads/ directory to another places for using with Super Cache plugin. That did not worked correctly then I was using WordPress plugin for S3 to upload files.

After all of the above, I was looking to remove Amazon S3 as this was looking a redundant step and distribute all files using Cloudfront. CloudFront will take all files from my Http server directly. I have implemented it recently.

To implement CloudFront that takes all files from my server, I need to implement Origin-pull / custom origin feature in Cloudfront. Search for term origin-pull or custom origin with cloudfront if you want similar settings. Most of documentations will mention Amazon S3 first then Http server/origin-pull/custom-origin.


CloudFront Implementation/How to Setup Cloudfront:

When I implemented CloudFront this time, then I placed uploads/ folder to its original position as these all create unnecessary problems in future. I used SymLinks to place everything in a sub-domain and used that as Custom Origin for CloudFront. Create another sub-domain for Cloudfront where you will change CNAME which points to cloudFront distribution. So, –> Amazon will pull all files. Mention this in aws console for files source. –> your resources (img/js/etc) will be served from here. Image location:…. can have all files you want to server from CloudFront. Something like this:>

  • (a symlink is better. Don’t more files)

Based on the above structure, your links to cloudfront resources will be:


Extra: Amazon News