Amazon CloudFront is one of the cheapest and best ways to boost your page speed times.
Your media files (images, files, etc) will be hosted on Amazon’s servers instead of yours. This saves bandwidth on your host. For example, when you receive too many hits on a large image, your host will have a surge of requests. This is especially bad when you’re on a cheaper shared hosting when you’re limited on how many requests you could have in a certain amount of time.
Depending on your traffic, Amazon CloudFront will cost you anywhere from less than a dollar to maybe a few dollars. Last month I paid $3.50 for two high traffic domains. Don’t worry about any surprise costs even during high traffic. It’s really cheap. It’s one of the best investments you could have for your blog.
One of the coolest features is that the content is to the end-user depending where they viewing your site from. So someone from Thailand automatically be downloading your content from their Asia servers. The closer the user is to a server, the faster the content is downloaded. Other locations include United States, Europe, Asia (Tokyo), Asia (Singapore), and South America.
Another reason I chose to use a CDN (Content Delivery Network such as Amazon CloudFront) is because I can upload all images straight onto my website using WordPress instead of hosting images on Flickr or Smugmug and having to embed it. This also allows contributors to the website upload directly onto the website. Not only does Amazon have my files, but I also have them on my server. For example, http://artofbackpacking.com/wp-content/uploads/2011/07/http_links.jpg is the direct link to the image but Amazon will download and host my file to http://media.artofbackpacking.com/wp-content/uploads/2011/07/http_links.jpg automatically. If I choose to not use Amazon anymore, I don’t lose anything besides media.artofbackpacking.com location unless I decide to use another CDN service.
Amazon and W3 Total Cache automatically downloads everything you upload onto WordPress media section. You never have to do a single thing. All self-hosted images is redirected automatically while still keeping your original location as well.
So here’s how to set it up.
The guide is specifically for self-hosted WordPress.org users.
1. Sign up for Amazon Web Services. It’ll ask for your details. There is no cost for signing up.
2. Install W3 Total Cache plugin for WordPress. If you’re using any other cache plugin like WP Super Cache, you’ll need to uninstall it and use W3 Total Cache instead. In my opinion, it’s far superior. You may need to do extra required steps by W3 Total Cache. Follow the boxes shown above and click auto-install. Disable Preview Mode under Performance -> General Settings and make sure everything on your site still looks okay.
3. Enable CDN by going to Performance (on your sidebar) -> General Settings and select Amazon CloudFront. Save.

4. Go to Performance -> CDN. Under Configurations, we’ll be filling out some fields. Keep your WordPress page open and go to Amazon’s Security Credentials page. You should find your Access Key information there. If not, create a new access key with their link. The password for your access key is also provided by clicking on Show. Insert the information you got back into the CDN Configuration screen on WordPress.

5. Click Create Distribution. You’ll see a random characters filled in on Replace site’s hostname with: field. Click on Test CloudFront Distribution to make sure it works. Be sure to SAVE.

6. Sign in to the AWS Management Console. Click on the Amazon CloudFront tab. You should now see your created distribution. It might take some time for Amazon to download all of your content depending how many images you have.
BONUS GUIDE! Setting up a CNAME.
Right now you’ll see that all your images is being hosted on Amazon. You’ll notice that the location of the file has the address of Amazon instead of your website. Nothing wrong with that but it doesn’t look very good. It’s also not very good for your SEO. You’ll want the images to have your address and not someone else’s. Another reason is in case you’d like to switch to another CDN service — you’ll want to keep the address of all your images.
What we’re going to do is create a CNAME so instead of an Amazon address, you can have something similar like what I have on Art of Backpacking. All of my images is hosted on http://media.artofbackpacking.com. You could never tell I use Amazon.
This guide will be for users who use HostGator but many other hosts have a similar dashboard and you could probably follow along.
1. Go to your HostGator control panel. Then under Domains, click on Simple DNS Zone Editor. Select your domain.

2. Fill in the Add a CNAME Record fields. For NAME, you’ll want to create the domain you want to use. I use media.artofbackpacking.com. Feel free to use images, img, or whatever you feel like.

3. Fill in the CNAME field. To find what you need to put in here, go back to your AWS Management Console and go to your CloudFront panel. See where it says Domain Name? Mine says d2e5aqj1k9xwk4.cloudfront.net. Copy yours and insert that back into the CNAME field you were looking at earlier in your HostGator control panel. Click Add CNAME record.

4. Go back again to your AWS Management Console CloudFront panel. Click on your distribution and click EDIT. Under CNAMEs, put in the domain you put in earlier like media.artofbackpacking.com. Save (Yes, Edit button).

5. Now go back to your WordPress -> Performance -> CDN. Go to the Replace site’s hostname with field and there should be a number 1. Enter the domain you picked. Mine being media.artofbackpacking.com. Don’t click Add CNAME for more records. Just click SAVE.
Optional: Maximize CDN usage by button. On the top of CDN page for W3 Total Cache, there’s a button that says importing attachments into the Media Library. Be careful with this. If you want, it’ll download all images hosted from other websites and upload them to your side and then onto Amazon. So images embedded using Flickr, uploads to your website and redirects it to Amazon as normal.
That’s it!
For personal support, please see the AOTB forums.
{ 29 comments… read them below or add one }
Excellent post! I’ve actually been looking at using Amazon’s services – the better to balance out Google on some small level. Could you quantify how much faster your site has gotten, or is there any indication of an SEO boost (coming from the speedier website)?
Chris in South Korea recently posted..Destination: Manjanggul Lava Tubes and Crater Mountain Peak (Jeju-do) – part 1 of 3
I can’t really tell if Google has ranked me higher because my site has been faster. It’s tough to judge. I’d like to hope so though and if anything, the user experience on a faster site is better anyway.
I’ve run a few tests before and it was definitely faster. I’ll post up my results and compare in another article soon.
Michael Tieso recently posted..How to Install Amazon CloudFront and Why
extremely useful. i’ve been considering this since Flickr is not the fastest, and they make it extremely difficult to keep all of my files afterwards. my question would be – is there an easy way to view all the files within the amazon cloud? i do like that i can browse through my photos via flickr, so i can pick out the ones i want to use.
suki recently posted..Notes – Wisconsin Cheese + California Beer
There’s no way at all to view what has been uploaded to the cloud. All your media files would be what’s on the cloud. My suggestion would be to make sure when you upload onto Wordpress to tag your photos and give it a proper name once uploaded so you can search for it. I know it’s not exactly the easiest solution. Another option is using the NextGEN plugin where you can upload everything into an album and gallery.
Michael Tieso recently posted..How to Install Amazon CloudFront and Why
Great tutorial Mike. I initially signed up for Amazon S3 a year and a half ago, but I think Cloudfront is really what I needed.
I am still a little hesitant about uploading all my photos via WordPress though — won’t that greatly increase the size of our blogs (from the perspective of backing up or moving the site to another server/host)?
I’m tempted to use this feature “importing attachments into the Media Library” but again, that would immediately increase the size of my site given the almost 5 years worth of photos published using Flickr URL’s.
Dave recently posted..Bartolome Island: Sunset Over a Martian Landscape
That is definitely true that it would increase the size your space usage. As long as your photos are well optimized, it shouldn’t be too big. For every picture, it will also add records to our database and again increasing the size.
I guess in these cases when you already have a large and established website, you’ll need to weigh things out whether it’s worth it. Flickr is great for hosting but I rarely see large established websites host all their images with Flickr. I like the idea of having all my files in one central location where it just moves everything all at once and I own it all.
Michael Tieso recently posted..How to Install Amazon CloudFront and Why
What do you mean by “well optimized” photos?
Dave recently posted..Bartolome Island: Sunset Over a Martian Landscape
You can have the same JPG file either be 500kb or 100kb and the quality will be nearly the same. If you use Photoshop and click on Save for Web, you can reduce play with the settings on how the original looks and how it looks optimized. Reducing the quality of the photos and no one even notices the difference.
Graphics too. You can reduce the number of colors being used and the end-user notices no differences at all.
Even if you do end up using Flickr or SmugMug, CloudFront hosts everything else in between from javascripts, css, and HTML loading. So using CloudFront doesn’t have to mean just for images but also for loading of all your other files on the website.
Michael Tieso recently posted..How to Install Amazon CloudFront and Why
The Cloud, whoever serves it up, is the future of blogging and on-line games.
AstroGremlin recently posted..Quotations of Famous People’s Much Less Famous Relatives
Good, concise article. For those interested in more on the same topic, including more details about W3 Total Cache and also the Cloudflare service, check out my article, Speeding Up Your WordPress Blog with W3 Total Cache (W3TC) – http://www.lengthytravel.com/speeding-up-your-wordpress-blog-with-w3-total-cache-w3tc/
Thank you great article. I’m having some difficulties with my SSL. It no longer displays when I click on my favicon. Also I’m getting some certificate warnings from other sources. Akamai Technology Inc, and certs for edge.quantserve.com
Sorry I forgot to mention, these certificate errors are only after installing w3tc.
nevermind… easy fix. Get rid of my SSL, was pretty much the only way I could do it and keep W3tc. Otherwise I had to do lengthy uninstall only to go back to slow page loads.
Excellent! Just what I was looking for. We’re now using CloudFlare and hopefully things will go smoothly as soon as we get CloudFront up and running.
marlys recently posted..Update: Midnight in Paris
Thanks for this. Had it bookmarked for a while, but was waiting for the site redesign to implement it.
I think it’s important to point out that if you are creating a new CNAME record, it will cause some delays. I went through all the steps anad verified that Amazon could see everything and was working, but when I set up the CNAME (my registrar is not my host, fwiw) record, my images broke. Had to turn off the CDN portion of W3 Total Cache until the rest of the internet notices the record creation (14400 seconds or less
.
I also think setting up the CNAME record is an essential step for SEO, not something that should be relegated to “bonus” territory. It’s really important!
Anyway, thanks again. Saved some fear and time on my part. Cheers!
Great post as I kept hearing about Amazon, S3 and storage but nobody ever broke it down on how to install. I will have to give this a shot on one of my dummy websites and see how it goes.
Protandim Dad recently posted..Lia Sophia Jewelry Business
Great helpful piece. I’m about to jump in, just want to have some extra info. We’re using Flickr for our pics. Would I need to stop using pics via Flickr if we go on Cloudfront? What if I decide to take it out of Cloudfront sometime in the future after getting into it, how easy would it be? I want an exit strategy obviously.
Michael recently posted..A Christmas Gift For A Hiker Kept Indoors For This Holiday Season
Thank you so much for this tutorial!
I went back into Total Cache, and entered the ‘Replace site’s hostname with:’ (but I did click the Add CNAME button). Now when I go back to that page, that field is filled out, but the rest of the fields are blank. Is that normal?
Thanks again. This post was very helpful.
Dustin recently posted..Videozoom
-Is it normal for all my images to be broken while it is downloading?
Dustin recently posted..Pro Blog
I am already using W3 Total Cache plugin, I will try for Amazon CloudFront
thanks very nice info
Dean recently posted..4 Easy Steps To Get a CNA Certificate Online
Thanks for the easy-to-follow step-by-step (with screenshots!) tutorial – even for someone like me who’s semi-webby, this can get tricky. Kudos.
Best configuration directions I’ve ever seen for using Amazon Cloud Front with a WordPress site, W3 Total Cache plugin and on Hostgator. Thanks so very much!
David
Hi,
Just wondering how long it took everyone for Amazon to start serving up the images? as mine are still showing locally, is it minutes? hours? days?
thanks
Daniel
Hey Michael,
This article is a bit outdated so I’m wondering if you still rank this as the best CDN out there (for the money)?
Also, I currently use Cloudflare – can I use both at once? Is it worth it or am I fine with just Cloudflare?
Dave from acoupletravelers recently posted..Europe route is out!
It still works perfectly well and not really outdated yet. Amazon Services is still great and I still use it. Cloudflare can be used with Cloudfront. The two do totally different things though.
Michael Tieso recently posted..5 Surprises About Travel Blogging From A Fledgling Travel Blogger
Thanks for an informative article. I hadn’t realised that this was so easy to do. I’m hoping for a real speed boost for my site. The server can take care of the queries, while all the media and stuff gets served up instantly from Amazon, and cheaply too. So much cheaper than upping my bandwidth.
The only issue I had/have was uploading my media library. As i write, its taken 2hrs 40 mins to upload 700 out of 5400 attachments, which feels slow to me. Now if only it upped the most recent files first – then at least my site wouldn’t look so borked!
Dave Roberts (@Mudandroutes) recently posted..Some Major Site Updates
Hello Michael,
This is a very informative piece of article however I wonder should I use PULL or Push and how does this effect CDN?
W3 Cache displays 2 options (Pull and Push) and should I just use Clouldfront or S3 also?
Thank You,
HariBhol
Either one should work. If you Google Pull vs Push CDN on Google, you’ll come up with some better explanations.
Michael Tieso recently posted..How Kaplan Used a Contest to Take Advantage of Bloggers
Hi Michael,
Hopefully you can help – I was able to sign up for Amazon, etc. but I am stuck on the “Create Distribution”. It says ‘Creating…’ but doesn’t do anything. Any suggestions?
Brendan recently posted..Bands You Must Know: The Racer