fbpx

Using Amazon S3 with WordPress

Recently  I wrote a post on Keeping Fat Content Off Your Site, in that post I mentioned the service Amazon S3, today I want to expand on that post and tell you in more detail what S3 is and how you can integrate S3 with your Blog.

What Is S3?

S3 is the acronym of Amazon’s simple storage service.  Using this service you can store files on the Amazon infrastructure and access them from your WordPress blog.

But Amazon Sell Books Not IT Infrastructure!

Yes they are an e-tailer first and foremost, but they have built an absolutely fabulous back end solution for their IT requirement.  It is incredibly robust and scalable so that can roll out new functions and products to their vast website quickly and easily.

They knew that were onto a good thing and thought that they though they would sell that as well.

The Amazon web service (AWS) family of products comes directly from what they were doing to host and sell all of their myriad of products.  They had to have an incredibly flexible way to expand their capacity quickly and easily.  It is these systems that Amazon have packaged up and made available to the wider online community.

What Can You Do With s3

S3 is a storage container, you can host all or part of your WordPress site on S3,  The majority of people reading this post will want to host their pillar content on s3.  This can be big e-books, videos or other content that you are expecting a lot os people to access.  This is what I will concentrate on in this post.  If you are interested in hosting your entire sites please check out Amazon EC2 http://aws.amazon.com/ec2/.

Drop It In  A Bucket

The individual unit of storage is called  a bucket.  You create a bucket on your s3 account and upload files to that bucket, these files can then be accessed via a URL like this http://{yourbucket}.s3.amazonaws.com/filename.

You Can Secure Your Files

S3 comes with a number of security features so you can secure your uploaded files and control who can access the information.

Access to your storage space is granted via a public and private key pair.  A blog on WordPress is not the place to go into PKI cryptography, but in brief you get two long strings of characters, one public that people use to decrypt your messages, and the other private which you use to encrypt messages, these are used instead of login IDs and passwords.

Using an access control list (ACL) you can set permissions on the file, the permissions are read, write and full control.  There are also two other permission levels to allow people to set ACL privileges.  Permissions can be set for everyone, authenticated users or the file owner you, via the email address of another s3 user. The acl can be set at a bucket level or on individual files.

Full details of the security model can be seen at http://docs.amazonwebservices.com/AmazonS3/latest/index.html?S3_ACLs.html

ACL & Pre-signed URLs

Another security feature of S3 is a pre-signed URL, using this and an ACL, you can create a link to a secured file with time limited access.  This is excellent to provide secure controlled access to your content.  Your reader gets a link, that can only be used for a set time, if that link is shared withs.  WordPress membership sites owners with premium content I am looking at you here.

Let me paint a scenario, you have a WordPress membership site with premium videos for example, you d’n;t want to share it on YouTube because you want people to pay, then upload it to S3, slap on an ACL so only authenticated users can see the content, then provide a link to that video with a pre-signed URL which last for an hour.  Your member views the video but decides to share the info with non-paying members, the link will only be valid for one hour, any attempt to access the link after one hour will return a access denied message.  Problem solved.

Cost of Storage

You pay for your storage in three ways:

  1. When you transfer in or upload files to your account
  2. You pay an ongoing storage cost for your files
  3. You pay when people download your stuff

This may seem a bit harsh to be hit three ways, but consider this,  the charges are pennies the cost as of November 2009, you pay 0.15 cents for the first 50TB of storage, that is not a typo 50 terra-bytes, you need to write a lot of e-books to fill 50TB see update below.  10 cents per GB to upload files to your buckets and 1 cent per 10,000 gets or downloads of your file.  That is not a lot of money for the potential infrastructure you could build.

UPDATE: You pay $ 0.15 per GB for the  forst 50TB of storage per month, my mistake thanks for the heads up Markus, still not a bad deal, but not as good as I outlined appologies.

For current pricing see http://aws.amazon.com/s3/#pricing

Tell My Why is it such a Big Deal in 100 words or less

You can store and deliver huge amounts of content securely, robustly, and very cheaply.  You can distance yourself from performance problems when delivering content, and not impact other areas of your site streaming fat content. (35 words)

Are there any plugins? You Betcha!

I have used the following plugins in line with S3.

Amazon S3 Plugin For WordPress – http://tantannoodles.com/toolkit/wordpress-s3/

This plugin allows you to upload content directly to your S3 buckets from inside of WordPress.  It allows you to host your entire uploads directory on S3 so everything you add to yoru blog be it images, video podcats etc will be hosted and served from Amazon’s site.

Amazon S3 URL Generator – http://codepolice.net/2008/12/08/generate-expiring-urls-for-amazon-s3-via-a-wordpress-plugin/

Now this one comes with a caveat, it is an experimental plugin, the developer clearly states that and I had to re-code it a little to meet my needs, but it dynamically creates a presigned URL link to your content.  I am using this on the WordPress Owners Club to secure my screencast videos.  If you are happy with a little coding this is an excellent plugin.

Amazon S3 Firefox Organizer – https://addons.mozilla.org/en-US/firefox/addon/3247

Whilst not a WordPress plugin, this FireFox plugin is an excellent little tool upload and download files to your buckets, it lets you set ACLs and create new buckets on your account, create test presigned URLs and in fact you can do most things on your S3 storage area with it you would want to, my must have tool for using S3.

Why I am Using S3

When you start adding fat content to your blog, your hosting account will quickly become swamped with requests, your blogs performance will suffer.  I wanted to off load this larger content to a more robust platform but did not want the cost of an individual virtual private server.  S3 provided this for me.

Computing in the cloud is the way forward for bloggers, very few of us host our own sites on physical boxes we own, we are using hosting providers and their limitations.  As big net based companies start providing cloud infrastructure that is cheap and robust I can see many of us moving away from Godaddys and the like.  I expect to see Microsoft, Google and the big online boys and girls following Amazon in the future.

Wrap Up

If you are concerned that your latest fat content will go viral and kill your site, check out  S3 so your site does not kick the bucket (see what I did there ? What a clever use of the word bucket, our storage unit and the euphemism to die I am soooo funny I am.)

Leave a Reply

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