Feature request from owenhaynes, posted on GitHub May 31, 2015
Is there any plan for a media stroage api, was looking to see if it was possible to use S3/Cloud Stroage for media assets. So that Elastic Beanstalk can be used effectively.
I don't think storing the images in the database is the correct option when S3 storage is far cheaper and faster to run then a database.
Have had a look at the code and it seems very tightly coupled with File and Database, so creating a plugin seems a lot of work.
Comment from ooxi, posted on GitHub May 31, 2015
Comment from alankent, posted on GitHub May 31, 2015
I will let the product folks comment in roadmap, but curious as to benefits of storing directly in s3 vs storing in DB and letting CDN take the load. So performance of DB not so critical.
(There is no big effort planned here internally that I can recall, but always open to ideas about putting in interfaces etc making it easier to replace our default functionality with other functionality via di.xml - so feel free to suggest where you would put such an abstraction layer. Start with comments, can see if any feedback, then move on to a pull request if you are keen. This is not specific to this request - this is true of making any replacement point easier. Suggest, confirm, code.)
Comment from owenhaynes, posted on GitHub May 31, 2015
S3 is a lot simpler to set up for a small store, just looking at Amazon CDN looks like a bit of effort to set up. We also by using a database have the extra memory foot print in php by having to load the image into memory.
The MediaStorage module looks partway there to being an API, it just looks like some of it could do with be re-factored so that its more generic.
Most likely need an interface for the admin section for any set up if may require, as well as the interface for serving the files.
I think the biggest issue is that
is used all over the place for things like order documents and admin data?
I understand them being need to be stored in the database, but this feel like it confuses order system data with public data, so would have to some how refactor this out in the process, so that media storage only covers public media.
Comment from kandy, posted on GitHub May 31, 2015
Looks like simplest way to implement s3 in m2 is s3 stream wrapper and configuration media dir as s3://media/
PS: i don't try this
Comment from jameshalsall, posted on GitHub Dec 13, 2015
Any news on this?
Comment from Khaleel, posted on GitHub Feb 03, 2016
What you do for NGINX is create a directory and origin pull that directory. Example
This in vhost has a web directory of
So Magento2 will always upload to the media folder - you can do the same (I think for pub folder for JS and CSS)
Thus in the CDN just make an origin pull with a cname
Then in Magento under the Admin > Stores -> Configuration -> Web.
Just update your media URLs
Comment from craigcarnell, posted on GitHub Feb 03, 2016
I have the same issue except we use Rackspace CDN. For m1 I modified a free magento extension to do this (onepica) but that never got released for m2.
I am also using Rackspace CDN...
@Khaleel The onepica module uploaded the files to the CDN using the API available for Rackspace. I modified it to work with the UK version
Sounds good. I too am using Rackspace UK as LON region. Also international API. It would have been nice to have official support from the Magento platform for CDN integration rather than modules. Varnish (personally not a fan) and things like caching come out of box. CDN should be default now across Enterprise.