Amazon CloudFront is the CDN element of Amazon Web Services (AWS).
First unveiled in beta form back in 2008, CloudFront currently uses a global network of 79 edge locations across 49 countries covering North America, Europe, Asia, Australia and South America (the detailed list is here).
CloudFront can speed up the delivery of any files or content that you would normally serve over HTTP(S): static, dynamic, or media streaming. There's integrated support for on-demand streaming via RTMP, too.
The service uses a multi-tiered approach where content may be held in 11 additional regional edge caches. If content isn't cached at the closest edge location, CloudFront checks the regional cache. If it's still out of luck, the service maintains persistent connections with your origin servers, and uses further network optimisations to improve speed and response times.
Deep integration with Amazon Web Services means you get access to all the regular AWS features.
You can transfer data between CloudFront and other AWS services, such as Amazon S3, at no charge.
The AWS Certificate Manager can create and deploy as many custom SSL certificates as you need, at no extra cost.
Built-in protection from AWS Web Application Firewall helps protect you from common exploits, AWS Shield keeps you safe from common types of DDoS attacks, and everything is managed from the regular AWS console.
If you're unsure whether CloudFront is right for you, or you're a total newcomer to CDNs, there’s some good news: a Free Usage Tier gives new AWS customers 50GB of traffic each month, for one year. That's perfect for running initial tests and understanding what CloudFront and CDNs might be able to do for you.
After the free tier, there are no fixed contracts; you pay for what you use. Sounds simple, right? But it really isn't.
While providers like MaxCDN and KeyCDN charge a flat rate for delivering data to any region, CloudFront prices vary from a starting $0.085 to the US and Europe, rising to $0.25 in South America. (If you're on a budget you can choose not to serve content from the more expensive locations.)
You're also charged for requests (from $0.0075 per 10,000), and the figure varies depending on whether it's HTTP or HTTPS.
Amazon helps out a little by providing a Simple Monthly Calculator (choose CloudFront in the left-hand sidebar). Select a sample site which most closely matches yours and it provides an estimate of likely charges.
To try this out, we took a test example of a small UK-based site serving 100GB of traffic, with an average object size of 100KB, and US and European visitors making up 80% of its traffic. Assuming all traffic was via HTTP, the initial monthly cost would be $4.25 (£3.40), rising to $10.61 (£8.50) in year two after the free tier expires.
To see how that might increase, we dropped the average object size to 10KB to generates more requests, switched to HTTPS using the free shared certificate, and shifted 70% of our traffic from Europe and the US to the more expensive Hong Kong, Singapore and Taiwan. This time the initial monthly cost was $16.21 (£13), rising to $26.20 (£21) in year two.
There's a lot to consider, but overall CloudFront offers better than average value for what you get, although some – like KeyCDN, or MaxCDN – can be notably cheaper.
Keep in mind that CloudFront does assume a lot of experience, and even tech support costs extra – from $29 (£23) a month for anything more than customer service and community forums. If you don't need its more advanced features, you might prefer a provider with more support and a simpler fixed-price plan, even if it does cost a little more.
Signing up for CloudFront couldn't be much easier. Amazon's initial free tier means there's no need to hand over payment details or enter much in the way of personal information. Just enter your name and email address, choose a password, accept the default Basic support plan and you're done.
The starting AWS console doesn't give you many clues about what to do next, but searching for ‘CloudFront’ gives you an option to create a new web-based or RTMP Distribution.
Setup looks complicated, thanks to a Create Distribution web form with more than 30 options. Fortunately, only one of them is required. Type your domain name or S3 bucket in the Origin Domain Name box, hit Enter, and the service creates a CloudFront distribution for you. This can take several minutes, but once it's done your site is allocated a CloudFront domain name, like "d3vwin5gov9p15.cloudfront.net".
You can use that domain immediately to point to a site object, like d3vwin5gov9p15.cloudfront.net/images/image.jpg. When CloudFront receives a request for the object, it serves it from the nearest location if it's in the cache, and fetches it from the website if it isn't.
Using the CloudFront domain isn't the best option for SEO purposes, but you can set up an alternative domain name (a CNAME record) to point to it: for example, having cdn.mydomain.com resolving to d3vwin5gov9p15.cloudfront.net.
There are many other ways to customise a CloudFront distribution: you can enable automatic GZip compression to improve speeds. Set the amount of time an object remains in the cache before CloudFront checks for an update (24 hours by default). Define HTTP support (accept, redirect to HTTPS, HTTPS only). Use the default CloudFront SSL certificate, or a custom alternative.
Clicking an Information icon next to each option displays more details about it, and there's also a very comprehensive ‘developer guide’. This is very readable in places (check the CloudFront introduction here), but the sheer weight of features can make it seem intimidating. Browse the full documentation on CNAME to get an idea of what's involved.
Once you're up and running, CloudFront's detailed analytics are a highlight. It's easy to view CloudFront requests and data transfer usage by date, billing region and more. There are charts to show popular objects, top referrers, and basic details on your visitors: browser, device type, OS and location. You can even set up customisable alarms to warn you when metric data hits some level you define, such as "data transfer usage is greater than X – potentially very handy in a pay-for-usage product.
Put it all together and there's a lot to like about the CloudFront control panel. CDN beginners will find it intimidating, at least initially, but there is detailed help available. If you're experienced at creating and managing a website, you should be able to master the CloudFront basics in just a few hours.
Figuring out which is the fastest CDN is a real challenge, as there's no one simple answer. Performance varies based on location, and every website has its own mix of visitors – what's best for Europe and Japan won't necessarily work for America or India.
CDNPerf provides a good starting point for any evaluation by interpreting real user monitoring data (via cedexis) covering billions of tests.
In July 2017 CloudFront rated tenth place worldwide out of a test set of 24, with a query speed of 57ms. That's a reasonable result, a little better than some popular names (Fastly, CDN77, KeyCDN, MaxCDN), though lagging behind the top performers: jsDelivr (42ms), CDNetworks (47ms) and Cloudflare (47ms).
Global averages don't tell the full story. CloudFront rated a lowly 16th in Africa, but 8th in South America, and notably higher in some important markets – the service came second place to Tata Communications (Bitgravity) in India.
CloudFront also scores well for uptime, hitting second place with a figure of 99.89% (real user monitoring). The differences are small – the tenth place service managed 99.86% – but it's good to know the service is there when you need it.
CloudFront can be set up in minutes, is highly configurable, and has a wide network that reaches all around the world. Average speeds aren't the best and pricing is complicated, but Amazon's free plan means it's still worth a try.