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.
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:
How Amazon CloudFront works
Getting started with Amazon CloudFront is quick and simple. Let’s see what has to be done to configure CloudFront.
- 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).
- 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).
- 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.
- 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.
- 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.
- 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:
Important 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:
- Video Course: Working with Amazon CloudFront features
- Multiple Quizzes: Various Difficulty Levels of AWS CloudFront Quiz
- Hands-on Labs: Serve Your Files Using The CloudFront CDN
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.
WaitCondition Controls the Pace of AWS CloudFormation Templates
AWS's WaitCondition can be used with CloudFormation templates to ensure required resources are running.As you may already be aware, AWS CloudFormation is used for infrastructure automation by allowing you to write JSON templates to automatically install, configure, and bootstrap your ...
The 9 AWS Certifications: Which is Right for You and Your Team?
As companies increasingly shift workloads to the public cloud, cloud computing has moved from a nice-to-have to a core competency in the enterprise. This shift requires a new set of skills to design, deploy, and manage applications in cloud computing.As the market leader and most ma...
Two New EC2 Instance Types Announced at AWS re:Invent 2018 – Monday Night Live
The announcements at re:Invent just keep on coming! Let’s look at what benefits these two new EC2 instance types offer and how these two new instances could be of benefit to you. If you're not too familiar with Amazon EC2, you might want to familiarize yourself by creating your first Am...
Google Cloud Certification: Preparation and Prerequisites
Google Cloud Platform (GCP) has evolved from being a niche player to a serious competitor to Amazon Web Services and Microsoft Azure. In 2018, research firm Gartner placed Google in the Leaders quadrant in its Magic Quadrant for Cloud Infrastructure as a Service for the first time. In t...
Understanding AWS VPC Egress Filtering Methods
In order to understand AWS VPC egress filtering methods, you first need to understand that security on AWS is governed by a shared responsibility model where both vendor and subscriber have various operational responsibilities. AWS assumes responsibility for the underlying infrastructur...
S3 FTP: Build a Reliable and Inexpensive FTP Server Using Amazon’s S3
Is it possible to create an S3 FTP file backup/transfer solution, minimizing associated file storage and capacity planning administration headache?FTP (File Transfer Protocol) is a fast and convenient way to transfer large files over the Internet. You might, at some point, have conf...
Microservices Architecture: Advantages and Drawbacks
Microservices are a way of breaking large software projects into loosely coupled modules, which communicate with each other through simple Application Programming Interfaces (APIs).Microservices have become increasingly popular over the past few years. The modular architectural style,...
What Are Best Practices for Tagging AWS Resources?
There are many use cases for tags, but what are the best practices for tagging AWS resources? In order for your organization to effectively manage resources (and your monthly AWS bill), you need to implement and adopt a thoughtful tagging strategy that makes sense for your business. The...
How to Optimize Amazon S3 Performance
Amazon S3 is the most common storage options for many organizations, being object storage it is used for a wide variety of data types, from the smallest objects to huge datasets. All in all, Amazon S3 is a great service to store a wide scope of data types in a highly available and resil...
How to Optimize Cloud Costs with Spot Instances: New on Cloud Academy
One of the main promises of cloud computing is access to nearly endless capacity. However, it doesn’t come cheap. With the introduction of Spot Instances for Amazon Web Services’ Elastic Compute Cloud (AWS EC2) in 2009, spot instances have been a way for major cloud providers to sell sp...
What are the Benefits of Machine Learning in the Cloud?
A Comparison of Machine Learning Services on AWS, Azure, and Google CloudArtificial intelligence and machine learning are steadily making their way into enterprise applications in areas such as customer support, fraud detection, and business intelligence. There is every reason to beli...
How to Use AWS CLI
The AWS Command Line Interface (CLI) is for managing your AWS services from a terminal session on your own client, allowing you to control and configure multiple AWS services.So you’ve been using AWS for awhile and finally feel comfortable clicking your way through all the services....