Amazon CloudFront and Content Delivery Systems: An introduction

Amazon CloudFront: A brief introduction to the problem of optimizing web content delivery…and the AWS’s solution.

We’re going to learn about Amazon CloudFront and how to make it work for you. First, since CloudFront is a kind of content delivery network (CDN), it’s probably worthwhile spending a bit of time discussing exactly how CDNs work, and what they do.

Brief introduction to CDNs

The idea of a content delivery network (sometimes called a content distribution network) is nothing new. It’s really nothing more than a set of servers distributed across the Internet to serve highly available, high performance content to end-users.
The primary goal of a CDN is delivering content from providers (like media companies) to their audiences as quickly and reliably as possible. The model works by delivering content from the CDN server closest to the users who will consume it, thereby eliminating as many network hops as possible.
Among other advantages, a CDN can:

  • Offload traffic served directly from the content provider’s origin infrastructure.
  • Help manage denial-of-service attacks by absorbing some of the traffic.
  • Offer higher availability, lower network latency, and lower packet loss.
  • Sometimes reduce your hosting costs.
  • Handle increased numbers of concurrent users.

If there are advantages, there will be some negatives too:

  • Lock-in dependency on a single CDN provider for support availability.
  • Lock-in dependency on a single CDN provider for infrastructure availability.
  • Not all CDN providers will have data centers in exactly the geographic locations you need them for each of your projects.

The CDN market has many active providers, including CloudFare, Akamai Technologies, and Limelight Networks.

Amazon CloudFront

So we’ve described CDNs and some of the major players. But there’s someone really obvious we’ve left out.
As the cloud continues to dominate application and content delivery, Amazon Web Services continues to dominate the cloud. There can’t be many providers who haven’t at least considered moving their operations to the AWS cloud. At the same time, AWS works hard to understand its customers’ requirements and wants to be able to provide an environment that addresses all their needs. Since distributed content delivery is a common need, it only makes sense that AWS would offer CloudFront: a fully integrated solution.
To achieve the low latency connections providers need, CloudFront uses a global network of edge locations:
Amazon CloudFront - endpoints

How Amazon CloudFront works

Getting started with Amazon CloudFront is quick and simple. Let’s see what has to be done to configure CloudFront.

  1. The first step is to decide on an origin server. Like all CDN providers, CloudFront requires you to define the server hosting the content you want CloudFront to deliver across the distributed network. The origin server can be an S3 bucket or an HTTP server (either based in Amazon’s EC2 or locally in your own datacenter).
  2. Next, you will upload your content to the origin server. Anything that can be served over HTTP or a supported version of Adobe RTMP can be used. Typically, the content consists of web pages, images, and media files (video and audio).
  3. The next step is the most important one. You will need to create a distribution. There are two kinds of distribution that you can create: web distributions for HTTP/HTTPS, and RTMP Distributions for RTMP and its variants. Distributions are the way you tell CloudFront what content to use and what to do with it.
  4. If you want your content to be delivered over either HTTP or HTTPS, select a Web distribution, but if your deployment involves real-time data using RTMP protocols, then you should choose an RTMP distribution.
  5. You can create URL-matching rules for your distributions. For example, you could decide that any request that includes the string “/books/*” should fetch data from your HTTP server, but a request containing “/author/*” should go to S3.
  6. Finally, use the domain name endpoint that CloudFront gives you as URLs through which your users can access your content.

Note: You can fine-tune your distribution by setting values like the expiration time for files to remain in cache before they are refreshed, and which groups of CloudFront edge locations you’d like to use (i.e., US only, US and Europe, or all locations).
Once the setup is ready, your Amazon CloudFront distribution is ready to serve requests. Your DNS service will route a request from your end user to the CloudFront endpoint URL, and CloudFront will send it to the edge location that can best serve the user’s request. CloudFront first checks its cache for the requested files, if it’s there it’s all good. But if it’s not found in the cache, it checks your distribution configuration and forwards the request to the origin server.
This diagram can help to visualize the process:
Amazon CloudFront - structureImportant Amazon CloudFront features
Besides the more obvious features we’ve already seen, with Amazon CloudFront, you can also:

  • Enable AWS WAF (Web Application Firewall) which can help secure your content.
  • Engage in many e-commerce activities, since CloudFront is PCI DSS Compliant.
  • Configure the default TTL & Max TTL values (to control how long CloudFront will hold items in cache).
  • Invalidate Multiple Objects.
  • Add signed cookies for private content.
  • Add support for advanced SSL features: Perfect Forward Secrecy, OCSP Stapling, and Session Tickets.
  • Use CloudFront as part of the AWS Free Usage Tier.


I hope this blog was able to satisfy at least your initial curiosity about Amazon CloudFront. This is an exciting and useful area and I strongly encourage you to investigate the free 7-day trial subscription from Cloud Academy. They offer multiple learning products on this very topic:

AWS course and quiz
AWS CloudFront quiz and lab
I’ve tried to inspire your desire for greater learning. I haven’t attempted a deep dive because that must requires greater time and space than this blog offers. What I’d like you to take away from reading this post is a familiarization with the way that AWS handles the problem of fast and efficient content delivery. Maybe you are motivated to dig deeper with Cloud Academy’s labs, video courses or quizzes. Cloud Academy labs let learners work in a real AWS environment without setting up an AWS account. So take the trial and see what you think.

Feedback is critical to us, so let me know what you think and where we can do better.

Cloud Academy