i have developed a wordpress website which is hosted on AWS. The website is working fine but since i wish to make it an e-commerce website, there are going to be a large number of images. The hosting account of AWS gives only 30 GB of storage. So i wish to host images completely on an external CDN off my server. But recent search for CDNs has led me to just caching CDNs, i wish to host images on other server only. Any leads?
2 Answers
I've never heard of a CDN that replaces your servers storage completely, only mirroring.
However, I know (as I've done this on multiple installs) you can offload your current and future media library items to AWS S3 with a plugin like Media Cloud. Media items get off of your pricy and limited hosting server, and put onto a inexpensive and unlimited cloud hosting servers. AWS S3 is super cheap for hosting files, much cheaper than storage on EC2 or Lightsail (whichever one is capping you at 30 GB). However it's important to note that the bandwidth for S3 can be ..surprising. So to work around that you can use Jetpack Image CDN (formerly "Photon") service to deliver the images (or a service like CloudFlare).
So with this setup you're offloading the images, which costs very little (see pricing) to S3, then delivering them to public through a CDN for free. This leaves your hosting cost low, your offloading media cost low as possible, and your CDN is free.
This setup takes about 15 - 30 minutes to setup, and works like a charm. It can (I've seen it first hand) save a lot of money in hosting.
In the long run it is more trouble not to have your images on your servers than the extra money you might need to pay to extend your storage capabilities. The main reason is that if your site is successful you will probably want to to manipulate the images to produce different size of thumb and whatever, something that you can not do when the images are not on the server, and it is going to be an effort to get them there from a CDN.
If there are some hard limits to storage on a machine, the way to go around it is by adding network storage by using an additional server and NFS, but most host are likely to offer such functionality as a "branded" type of server. IIRC on AWS it is called block storage or something similar.
ml_media_upload_dir
function to write to an external host or at least link to an external host.