WordPress Media to Amazon S3 Bucket

Moving WordPress Media To AWS S3

“The Cloud” is all the rage nowadays and for good reason. It gives you more storage space, faster storage, and distributed access. It’s essentially an automatic backup and can take away a lot of the headaches that come with moving and testing a website.

While there are some disadvantages, like less access and security worries, these would either exist on your own server as well, or are more than worth it for most.

In this post I’ll show you how I offload all of my media onto Amazon S3 using WordPress and some plugins. I’ll also show you how you can use Amazon CloudFront to serve your files via a CDN for faster loading times and latency across the board.

Why the Cloud?

I already touched on why I am a huge fan of putting all my media in the cloud, but let me elaborate:

Detached Media

My main reason is that detached media makes my life easier. Imagine you want to migrate a website to another server. If this becomes necessary, chances are it is because your website outgrew its current lodgings – you probably have more than a few images.

Everything inside WordPress, like posts, themes and plugins, takes up very little space. Even a sizable blog may only have a database of about 2-3MB. Perhaps your themes and plugins take up 10-30MB, but most of those don’t have to be moved, they can be re-downloaded.

Whenever you upload an image to WordPress, at least three other versions of it get created (unless its dimensions are very small). This means that for each image you upload, there are actually four images on the server. So if you’ve uploaded only 100 images, this would amount to 400 images and could easily exceed 400-600MB.

Using fancy developer tools, you could easily transfer everything in your WordPress installation in a couple of minutes, and you would then spend hours on media. Not to mention upload/download timeout issues and other nuisances.

If you use a cloud-based storage service all your media is served from the cloud. If you don’t want to you don’t even have to think about the uploads folder anymore. In this sense, migrating even a very large site could take minutes.

Another related benefit is testing. If your developer uses a local environment to test, images will work just fine as they will be pulled from Amazon servers, as opposed to WordPress looking on a local hard drive.

Scale

Amazon is huge. You will not be able to create a site that their servers can’t keep up with. Say you have a site with 1,000 videos and hundreds of users viewing them at once. It seems like a lot, and it is. Amazon is so big it hosts for Netflix, which is one of the biggest streaming media provides and is just one of Amazon’s customers. The peace of mind you get knowing that your hosting needs are scalable can’t be understated.

Price

With great size comes great pricing. Amazon really is very cheap, which they can afford because of the huge amount of data they handle. The pricing is a bit complex because they charge for storage, requests, and transfer separately, but it’s all very cheap. Take a look at their pricing page.

Security and Control

Some people argue that a big drawback of using such a huge system is that if something goes wrong you can’t really do anything about it. I for one feel a lot safer using Amazon; I would bet on my server crashing before theirs. Unless you have multiple redundancies and a dedicated server team, chances are your current servers are way less dependable than Amazon’s. That being said, I actually do store my media locally and I also back it up as a precaution.

Getting Started

You’ll need a couple of things to get started.

Leave a Reply

Your email address will not be published. Required fields are marked *