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?

  • i have used s3 bucket in my magento , i just want to confirm that if my product images is connect with s3 bucket then why it will created all product images in my system server also ? i dont want product images in my system. i also tried to delete all images in mu system serevr but on refresh the page all images is regenerate in my system . Commented Apr 19, 2018 at 11:50

2 Answers 2


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.

  • thanks do you think I could use the S3 bucket for the media folder with the web urls?
    – Holly
    Commented Aug 31, 2015 at 10:35
  • 1
    Do you need to use S3? S3 is more expensive compared to Cloudfront when it comes to serving higher volumes. Have a look at the Amazon doc for more information to move from S3 to CloudFront: docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/…. When you are on CloudFront the extension most likely will work out of the box.
    – mkerstner
    Commented Aug 31, 2015 at 11:42

Now, i'm using bellow solusion.

  1. use s3 to store media file
  2. use cdn cloudfront point to s3
  3. Config subdomain (gallery.domain.com) point to cloudfront via cname record.
  4. In System > Configuration > Web > BaseUrl: http(s)://gallery.domain.com

(You can use ssl for this subdomain in cloudfront.)

  • if I have images already on s3 server then how images name will get for particular product? Means if i don't upload the image for a particular product then how it will identify which image needs to pull from s3 server ? Could you please explain this somehow? Commented Jun 19, 2017 at 7:58
  • You can use s3fs to sync images between webserver and s3 When you add an image to a product (or any image in a media folder), the image will be synchronized to s3. However, I have only used this solution on a test environment, and have not applied in practice. github.com/s3fs-fuse/s3fs-fuse
    – dat.tran
    Commented Jun 30, 2017 at 3:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.