404 Tech Support

AWS Cloudfront – a perfect CDN for small websites

Site speed matters to Google ranking and, more importantly, your visitor experience. In an effort to speed up my site, I decided I needed to get 404TS back onto a content delivery network. A CDN typically has the advantage of loading content from a different host name for parallel downloads as well as serving the content from geographically closer regions. It also decreases the server load by offloading those requests to the CDN servers.

I previously used MaxCDN because it offered a chunk of bandwidth at an annual price that was within my budget. After a couple years of using the service, I allowed it to lapse because I didn’t like the business model – so much of that bandwidth was going unused and did not rollover. Not seeing as much performance boost as I had wanted and not being a fan of seeing the money go unused, I did not renew with MaxCDN and went without a CDN for several months.

When I was looking for another CDN, I researched a lot of options just as I did when I was looking for external DNS. I researched all the big names like Akamai, EdgeCast, NetDNA, Rackspace Cloud, and others. I found CDN Planet to be very useful in getting the straight information and comparing multiple CDN features. I had a few requirements given my setup but was willing to pay a premium if a feature justified it. Since I would be using WordPress as the origin and streaming mostly static files, I wanted Origin-Pull as an option since it is rather straight-forward and tends to run into less issues. I would be using WP-Super Cache though I have also used W3TC in the past and both have the ability to work with CDNs.

The properties that actually excluded most businesses was 1) not being able to find enough information, particularly pricing, 2) having to “request a quote” before getting any of that information, and 3) wondering if they would actually deal with a site my size even though EdgeCast and others started appearing in ads around the web for me. I know MaxCDN was spun-off from NetDNA (and still uses their infrastructure) to specifically deal with small-medium businesses. I like that aspect of them but didn’t have the greatest experience, so I continued to look elsewhere.

After researching and reviewing the CDN was using Amazon CloudFront, part of the Amazon Web Services. It has a high number of global locations, with a pricing model based on what you use and simple settings to control your use of higher rate PoP locations versus reduced performance for visitors in that region.

CloudFront was a breeze to setup. Discounting a slight delay in activating my account since I have used AWS before and had cancelled my account, I had S3 up and running in a matter of 10 minutes. I then configured a CNAME on my DNS to redirect to the URL that Amazon provides. I configured WP Super Cache as you can see above by checking the box to enable CDN support and entering my CNAME. I tested out my site a few times and saw a general improvement from the various locations I tested from. One further recommendation from the speed test was to use multiple host names to allow downloading in parallel. CloudFront allows up to 10 host names, so I added a few more to my DNS and configured them through the AWS console very easily and soon they were up and running for a slightly improved performance.

I have been using Amazon CloudFront for almost two months now and am pleased with the speed and the offloading of some traffic from my origin server. I have previously had instances of consistent blog scraping and like all sites I deal with hotlinking. There are certainly trade-offs to enabling hotlink protection but it would be a nice feature if CloudFront offered it. Unfortunately, unless your application can generate and keep track of signed URLs, it seems you are out of luck when using CloudFront. I enabled the feature with MaxCDN and saw some downsides of images not showing in feed readers. Particularly now that Google Reader is being retired, it would be harder to keep track of all of the exceptions. Along the same lines as hotlink protection, the activity logs give you general, aggregated information about where your traffic is coming from geographically (which PoPs are passing traffic) but not exactly where it is coming from on the web. That would be a nice compromise to allow some manual hotlink discovery.

The biggest benefit of AWS has to be the right pricing and paying for what you use. It can grow if your site demand grows and you won’t end up paying more if your demand decreases. I ended up paying $1.07 for the first month of use, so I saved a considerable amount over the bulk, annual costs of other companies. There is also no contract with Amazon, so I could switch off the service if I ever had a need to. That direct pricing model though does make the hotlinking issue more important though since it could be a direct cost to you if a file you are hosting went viral.

You can use CloudFront without any other aspects of Amazon Web Services or you can fully utilize them, like S3 or Route 53 DNS. There are also apps designed to utilize AWS and a marketplace for packages like WordPress to get started easily. CloudFront is the only service I am currently using and I just wanted to share my positive experience of setting up and using it. If you have any questions, you might also check out the CloudFront FAQ for all of the details.