Photoblog performance tips: Day 8 – CDN Part 1 : Storage

Yesterday, we set up WP Super Cache to speed up our site, which is a great step. We can go further though and setup a way to cheaply host items in multiple places around the world, closer to those looking for it. This can speed up delivery, especially large items like photos.

Amazon (purveyor of everything from books to bookshelves), also have a pair of web services which we will set up now. The services do cost (s3 pricing, cloudfront pricing), but we’re talking about site being a couple of pence per year on top of normal hosting!

Due to my experience with setting up these accounts, I suggest you sign up for both of these first before attempting any of the other work involved. Be prepared to wait a few hours for your account to be setup (they email you when it’s ready).

Amazon Simple Storage Service – S3

  1. Sign up for an Amazon S3 account. This may take some time to come through.
  2. When you’re logged into the Management Console, go to the S3 tab.
  3. Create a storage area by clicking Create Bucket.
  4. It doesn’t matter what you call it, but it has to be unique. For instance mine is called phillprice-com-images, so you can’t choose the same name.
  5. Pick a region to host it. I’ve chosen Ireland as it’s close to me. There is different pricing for different areas. Northern California is roughly 10% higher to host in, and has no real benefit.
  6. You’ll now have a temporary URL http://s3.amazonaws.com/phillprice-com-images, but we won’t be using it.
  7. You have a choice in how you tackle the next bit. You can either mirror the folder structure that exists in your blog, or improve upon it.
    1. The easy option is to create a folder structure in S3 to match WordPress exactly, but only upload the js, css and images or…
    2. The better option would be to restructure it for a smaller url as possible, and then update the theme accordingly, so you could for instance create an images, css and js folder.
  8. When you have a folder structure ready, navigate into it and click Upload.
  9. Select the files you want to go into the folder and click Set Permissions.
  10. By default, all of the content you place in S3 is secure. As you want these to be seen by everyone, check Make everything public and click Set Metadata.
  11. Click Add more metadata, set the key to Expires and the value to something in the future. For instance Sun, 01 Jan 2012 20:00:00 GMT and click Start Upload.
  12. Repeat with the rest of the files. If it gets too tedious, try the S3 Fox extension for Firefox or Cloudberry Explorer.

Tomorrow we’ll get the files actually in use from Cloudfront, the actual CDN. It may take some time for it to work, so it would be best to Sign up for Cloudfront today. See you tomorrow.

More in the series:

back to top

3 Comments

Frank Zweegers
10am, 04/03/11

The picture says #11, while the title says day 12 ;) Nice series of tips by the way.

James Howe
6pm, 06/04/11

Good stuff, but I was wondering if you could elaborate on step 7 a bit more. An example of how you have things structured might be helpful. Thanks!

kay
6pm, 06/04/11

this is awesome!! thank you very much

back to top