Using Amazon S3 to host images for your blog

Amazon AWS logoThis blog had seen better traffic days and had not experienced traffic spikes from Digg, or StumbleUpon in the last 12 months. But in the rare cases it did, all of the shared webhosting services I’ve tried broke down and came close to suspending my account because of the sudden strain on their servers.

Upgrading to a VPS or dedicated hosting is not the solution at this time because those traffic spikes were just temporary, and after the buzz, I would be left with a much more costly hosting that I actually don’t need most days of the week/month.

Getting more storage and bandwidth from my current webhost would just be a temporary solution, because as the Uploads folder gets fatter with media files over time, it will not only need more storage space and bandwidth, it ultimately gives more load to the server’s CPU. In a shared web hosting environment, that’s a major problem.

The solution then is to offload media content, primarily images, to somewhere else that is more capable of handling and serving that content. That’s where Amazon S3 comes in.

What is offloading content and what is Amazon S3?

As mentioned earlier, offloading content is hosting static files like images, CSS files, JavaScripts, etc. to a different server. While this is a common technique in high performance systems like Google, Flickr, Tumblr, etc. ordinary webmasters and bloggers like us can also benefit especially if our shared webhosting environment is struggling with the load.

Amazon S3 or Simple Storage Service is ‘a dedicated static file hosting service on a pay-per-usage basis. With no minimum costs, it might be practical for lower traffic sites which are reaching the peak that a shared or single server can handle.’

I admit that when I first head about Amazon S3, I thought it was reserved only for the big boys and developers who really know how to setup and optimize web servers and stuff, you know, real server monkeys and those with deep pockets.

It turns out that Amazon S3 is cost-effective as it’s on a pay-per-use basis. Their current rates are reasonable and practical. I won’t go into full detail about their pricing schemes but from what I’ve gathered, high traffic sites which use Amazon S3 spend an average of $2-10 a day. This blog is not on that level yet, so costs are projected to be a fraction of that per day. And so as traffic grows, so will the site income right?

The steps I followed in this setup can be found on Inquisitr, which offloaded their images to Amazon S3 back in September of 2009.

Things you need for this project

You need an Amazon AWS account. It’s easy to sign up for or if you already have an Amazon account all you need now is to add a credit card to that account to be able to sign up for Amazon AWS which would be your gateway to having an Amazon S3 account.

Setting up your Amazon S3 bucket

Once you have an Amazon S3 account, you can use the S3Fox plugin for Firefox which allows you to fully manage your Amazon S3 account. If FireFTP is for handling your FTP needs, then S3Fox is for handling your S3 account all from the comforts of a browser.

You simply need your Amazon S3 Account Name, Access Key and Secret Key. All these can be found in the “Security Credentials” section of your Amazon AWS account.

Create an S3 bucket using S3Fox
Create an S3 bucket using S3Fox

Once S3Fox is connected to your S3 Account, you can use it to create what Amazon calls a “bucket” or a folder in Amazon S3. Click on the blue folder with a star to create your bucket, use a name that is unique and descriptive of its function. In this case, since it would be used for storing images from your WP blog, the typical name would be:

Edit ACL using S3Fox
Edit ACL using S3Fox

Right-click on it, and select Edit ACL. Make sure that you, the account owner, is the only who has the full access control to that bucket while the public aka ‘Everyone’ is only granted ‘Read’ permission.

Once that is done, we’re ready to prepare your WordPress blog to work with your Amazon S3 bucket.

Setting up your WordPress blog

The most common plugin used for this is the Amazon S3 for WordPress plugin. It has been a long while since the author updated the plugin but it works well with WP 3.0+. Download and install the plugin in your blog.

In the Amazon S3 plugin setup page, you’ll need again your Access Key and Secret Key.

Amazon S3 for WordPress plugin
Amazon S3 for WordPress plugin (click for larger view)

Choose the bucket you created earlier using S3Fox from the drop-down menu.

Ask support from your webhost first regarding CNAME records creation.

Hostname settings’ this is a tricky part. If you want your images to have the url instead of, then you would need to create a CNAME record for your domain.

It’s risky setting this up on your own using CPanel, so the best way is to contact the support team of your webhost or domain registrar and request that they create the CNAME entry for you.

Just tell them that you need ‘’ pointed to ‘’ wait for the propagation which could last between a few minutes to 24 hours.

Enabling File Uploads will allow all of your WordPress uploads to go to your S3 account. This will add a new button next to the Upload/Insert section whenever you create a new post, allowing you to choose between your server or S3 on a per post basis.

Expires Header is a feature that is related to caching. Since blog posts are often updated over time, enabling this option will do no harm.

File Permissions – enabling this is a must because it sets all your uploads to be publicly viewable. S3 sets files to private by default so this feature saves you the trouble of tweaking permissions for each file uploaded.

And that’s it! You’ve now setup your blog to offload your uploaded images and media to your own Amazon S3 bucket.


  • Less system demand for your server.
  • No need to worry about where to host your images or media, because it’s all up in the ‘cloud.’
  • Your images would be served more reliably because you’ve got Amazon’s vast infrastructure handling it.


  • Costs could go up as you use the service more, but as a result of traffic growth
  • Your images are now in a third party server so complications about copyright or country-based restrictions may arise.

As for me though, I’m happy with the setup. Images I use in this blog, including the theme elements are served faster and have improved page load times. I’d give it a month’s trial to see how it performs and if the costs are justified.

But offloading images to Amazon S3 is only one half of this grand plan to optimize your WordPress blog. In the next installment, I’d tell how I setup my WP to be optimized using Amazon Cloudfront CDN. Stay tuned for that.

3 Replies to “Using Amazon S3 to host images for your blog”

    1. Amazon S3 is on a pay-per-usage pricing, so it will depend on how much storage and bandwidth you're going to use per month.

      Using Picasa and purchasing more storage space from Google is a simple solution though.

Leave a Reply