As I stated in a previous post, I moved all my images, theme files, and js files over to Amazon’s Simple Storage Service or S3. The process was fairly simple with the right mixture of WordPress plugins. I’ll give you a basic guide on how I moved everything over to S3.
First things first, S3 is just storage. When creating your ‘bucket’ (we will talk about that in a bit), you select the location in which it will be stored. S3 isn’t a content delivery network (CDN), but Amazon does offer that with Cloudfront. Even though this isn’t a CDN, it will probably speed up your website as well as reduce burden on your web host, only costing you a couple cents a month (depending on your audience).
1. Sign up for Amazon Web Services
This is fairly easy, it even uses your existing Amazon account if you have one. Just go to Amazon Web Services and click Sign-Up.
2. Creating the Bucket
Once you have signed up for your AWS account you can create a bucket for your files to be stored in. This is fairly painless. Just log into your account and go to the AWS Management Console. Once your on the console page, just click on the Amazon S3 tab and click ‘Create Bucket’. You can name the bucket anything you want, but I named mine shinyidol. Best to name it something that makes sense as it will be the name in your S3 url, so mine ended up being shinyidol.s3.amazonaws.com. The second option is the region in which you want the files to be stored. There are multiple options depending on what region of the globe you live in or where you think your traffic comes from. You have now created your bucket.
3. Time to Install WordPress Plugins
There are a couple WordPress plugins that come in very handy optimizing your content to move to S3, moving the actual content, and use moving forward on new posts.
Optimize your content with WP Smush.it. This really has nothing to do with S3, but really just optimizing all your images before you move them to the new server. It is super easy to use, and even has a bulk Smush.It. You will probably see a 20% savings on your file sizes.
Move your content with W3 Total Cache. This is an amazing tool to help your site load faster, but we really are only using one feature in it, which copies the media library, wp-includes/ files, and host theme files to your S3 bucket.
Just download and install the W3 Total Cache plugin. Once enabled click on General and scroll down. You will have an option to turn on CDN. Just click the check box to enable, and select Amazon Simple Storage Service (S3) from the drop-down, and click Save all settings.
Now you have to tell it what account to copy the files too. Click on CDN in W3 Total Cache. From this screen we have two options, configuration of the S3 account with our WordPress site, and the tools that allow us to copy files to the S3 bucket. Configuration is simple, you will need your Access Key ID and Secret Key from Amazon, both can be found by logging into your AWS account and selecting Security Credentials from the My Account / Console button. Just copy and paste the Access Key ID and Secret Key, type in the name of the bucket you created previously, and leave SSL Support to Auto. Once you have those set, just click Test S3 Upload, and after a couple seconds it will say Test Passed and now your can click Save all settings.
Now that we have WordPress and our S3 bucket talking to each other we can start copying content to the bucket. W3 Total Cache makes this easy by giving you a tool that just copies everything for you and creates folders in your bucket. In the CDN options you can select what items you want to upload to S3. Just click one of the various options and a popup will appear with the total files it will export to S3. Just click start and your off! This could take a couple minutes depending on how many files you have in your library. Once that is done you can also move other files such as wp-include files and theme associated files. What makes this tool so handy is it also updates all your posts to point to the S3 files. So you don’t have to update anything in previous posts.
Once you have done all the steps above you WordPress blog should now be pulling all its images from your S3 bucket. You can do a quick test by loading up your blog and doing a shift + refresh. This will force it to pull all new content from the server not from your local cache.
The last plugin is Amazon S3 for WordPress with CloudFront. This plugin lets you upload directly to your S3 bucket and you get a fancy new icon next to your Media Library button. You use just the same way as you would uploading any other files previously.
Well there you have it. You should now have all your major media files on S3 at this point. You can run some tests via Pingdom to check your load times. I reduced my page loads from the 10 seconds range to 3 seconds, but also push all the heavy lifting off my shared host.