Magento – Using AWS S3 bucket to store media folder

awscdncloudfront-cdnmagento-1.9media

I'm setting up a Magento site on AWS for the first time and want to use a S3 bucket with Cloudfront CDN.

I want to store the media folder in an s3 bucket so that I can scale out the servers and they will all use the same S3 bucket. And use the CDN to speed up performance.

I've been doing a some research and it all recommends that I use an extension such a this one.

Why would I need to use an extension? I thought I could simply set the Base Media URL to use our bucket URL to my Magento config at System > Configuration > Web

enter image description here

Do you just need to use an extension for the CDN part? i.e. can I use the s3 bucket by simply adding the configuration above?

Best Answer

Having a quick look at the extension here are the benefits of using the extension rather than setting up CDN through web urls config. I've removed the marketing stuff...:

  1. The extension comes with a tool for refreshing the files on the CDN instantaneously. Without our extension, you have to use a tool on the AWS website called "Invalidation Manager" to make the CDN pull updated files from your server. The invalidation manager is very slow and somewhat unreliable. The invalidation manager also only allows you to refresh 3 files every fifteen minutes... so it is quite time consuming to use it.

  2. It prevents the CDN from being used on Javascript that requires same-origin loading. This is relevant to Javascript that is used for uploading files.

Having said that there also is a remark concerning S3 for this extension:

Currently it does not support S3 as the origin.

That being said, it uses your server as the origin in the same way that S3 works.

Basically, the extension caches your files on CloudFront and then serves them directly to your users from CloudFront. Every two hours the extension checks your server for a new version of the files and updates CloudFront accordingly.

Related Topic