AWS CloudFront

Learn via video courses

Overview

With AWS providing numerous cloud services that help us to handle the huge amount of data we are generating these days, the AWS CloudFront is a fast, elastic, and reliable content delivery network (CDN) service that helps to securely deliver data, videos, applications, and APIs to the AWS customers globally with low latency, high data transfer rates, and low network traffic thereby improving its performance offerings seamless experience to its customers all within a developer-friendly environment.

Key Terminology in AWS CloudFront

It's good to learn the terminology to understand the key terminology that you might read through the entire AWS Cloudfront article as follows:

  • Edge Locations: A global network of data centers where the data or content is cached. These are the nearest possible data center where your content request gets routed and content delivery to the end user takes place.
  • Distribution: The Content Delivery Network consists of a collection of edge locations spread globally. We create a Distribution when we create a new CDN in a network with us. Now the distribution is of two types:
    • Web Distribution: Used for websites(Static Content)
    • RTMP: Used for Media Streaming(Dynamic/Live Content)
  • Origin: Defined as the origin of all the data(content) that the CDN will deliver globally once it receives a request for the same. A few known Origin is an S3 bucket, an EC2 instance, or an Elastic Load Balancer.
  • Latency: Its defined as the measure of delay or time taken as the data reach its end users from the time request to gather the content was fired from the source point.
  • Points of Presence: These are collections of servers in geographically dispersed data centers where CloudFront caches a copy of the data.
  • AWS Content Delivery Network (AWS CDN): Represents a group of servers that are geographically distributed all across the globe and helps to provide fast and low latency delivery.
  • Amazon S3 Bucket: It is a public cloud storage resource offered by AWS.
  • Origin Access Identity: For sharing private content through the AWS CloudFront we use the Origin Access Identity (OAI). This marks a virtual user identity that gives your CF distribution permission or access to fetch a private object from the origin server we discussed above.

Now as we discuss and learn the key terminology, let’s dive into the article and learn what is AWS CloudFront.

What is AWS CloudFront?

Before we jump into understanding what AWS Cloudfront is all about, let us analyze the scenario of why it came into existence. It was quite rare to have its own Content Delivery Network back in the day, as it would cost the organization and it was quite tough for them to manage and maintain the complicated IT infrastructure involved with it. But with AWS into the picture, It completely took off the worry from the organization's shoulders.

The AWS Cloudfront has become a popular AWS globally-distributed network service as it helps deliver content to its users at low latency, low network traffic, and quick data access with minimal cost. The globally-distributed content delivery network(CDN) offered by Amazon Web Services, securely transfers content like software, SDKs, videos, etc., to the customers requesting for same at a much higher transfer speed.

globally distributed content delivery network example

When a user requests content, the request first automatically gets routed to its nearest edge location where it checks for its cache copies and delivers it immediately with the lowest latency possible. This caching of the content made the delivery network of content its best possible transfer speed and performance if found. When the content is not found, the edge location retrieves it from the origin server (like an Amazon S3 bucket, a MediaPackage channel, or an HTTP server) that has been identified for your content from where they deliver the data along with parallel caching of the content for similar future requests.

With AWS CloudFront CDN you can get an entire website, including dynamic, static, streaming, and interactive content delivered with its massive global network of edge locations. It gets integrated with many of the AWS services like Amazon Simple Storage Services (S3), Amazon Elastic Compute Cloud (EC2), Amazon Elastic Load Balancing, and Amazon Route 53. With the non-AWS origin server, The AWS CloudFront CDN stores the original as well as the versions of the content. This whole process of CDN gives the AWS CloudFront its lowest latency, low network traffic, and fast access to data while only for the transfer of data.

Features of CloudFront

Now let's learn about important features that AWS Cloudfront has to offer:

  • Global: The Amazon CloudFront can be referred to as the global service as it tends to use the global network of edge locations that are located across the regions.
  • User Friendly: As already studied, the AWS Cloudfront is quite easy and simple to set up and use which gives its users a seamless experience along with no worries to understand how to use the service.
  • Cost-effective Pricing: As far as pricing is concerned for AWS CloudFront, it only charges for the content that we deliver through the network. The AWS Cloudfront has no hidden charges as well as no up-front cost. It is less expensive, as it only charges for data transfer.
  • Compatibility: AWS Cloudfront is highly compatible with other AWS Services like Amazon S3, Amazon EC2 as origins for your applications, Amazon Shield Standard for DDoS mitigation, Elastic Load Balancing, or Amazon EC2. This adds to the AWS Cloudfrnt seamless experience that it offers to its customers as integrating the AWS CloudFront is easy to understand as well as implement.
  • Reliability: As the AWS CloudFront is widely known for its smooth low latency experience, we can mark the AWS CloudFront as a highly reliable service offered by Amazon. It is built on Amazon’s reliable infrastructure, i.e. when situations arise the AWS CloudFront re-routes the end users to the next nearest location via automatically using the edge locations.
  • Dynamic Transfer: The AWS Cloudfront provides both static and dynamic content delivery. Once one byte is loaded into the cache, it immediately gets transferred to the consumer who wants to retrieve content (Live Stream).
  • Fast performance: With its broad network of edge locations and caching properties for the content close to the end users, Makes the AWS CloudFront faster and results in low latency, high data transfer rates, and low network traffic thereby improving its performance offerings seamless experience.
  • Elasticity: As with most of the AWS services we don't need to worry about maintenance or its related costs. Similarly, AWS CloudFront also automatically responds if any action is to be taken in a situation when the traffic increases or decreases.
  • Encryption: The AWS Cloudfront is a highly secure application that does not cost extra as it inherits the features of AWS Shield Standard. Spread across the globe, The edge locations feature a 7 Layer of Protection named AWS Web Application Firewall.

Below is the diagram depicting the few features of AWS Cloudfront:

features of aws cloudfront

Benefits of AWS CloudFront

Listed below are three major benefits that the AWS CloudFront provides to its users and has wide demand accordingly:

  • Caching Content: When the AWS Cloudfront receives a request for delivering content to its users, its first step is to search for that Content in the nearest edge location, and if not found then after receiving the content for the origin server it parallel sends the content and keeps a cache copies for same for future perspective. this way AWS Cloudfront is low on latency decreases the workload, and smartly us the edge locations to provide seamless CDN to its customers thus resulting in high availability of applications.
  • Security at the Edge: With AWS CloudFront, the users get high security with the ‘Content Privacy’ feature it has. The highly-secure CDN allows both network and application level protection by which the traffic and applications benefit with a variety of built-in protections such as Amazon Shield Standard that too at no additional cost.
  • Fast and Global: The AWS CloudFront content delivery network (CDN) scales massively and gets globally distributed via its edge locations which gives its users a rich seamless experience with its low latency and caching properties. The AWS CloudFront network has 310+ Points of Presence (300+ Edge locations and 13 regional mid-tier caches) in 90+ cities across 47 countries. It leverages the highly resilient and private backbone network which ensures productivity enhancement, superior performance, and availability for the end customers. The HTTP or HTTPS protocols are majorly used for quick content delivery.
  • Deep integration with Amazon Web Services: The AWS CloudFront integrates very easily with major AWS services like Amazon S3, Amazon EC2, or Elastic Load Balancing, for which you won't even need to pay for any data transferred that might take place between these services and AWS CloudFront. You can access all the integration via the console where all the features in the CDN can be programmatically configured by simply using SDKs or the Amazon Web Services Management Console. Lastly, if you use Amazon Web Services origins such as you don’t pay

The below diagram showcases the benefits the AWS Cloud front has to offer its users:

benefits of aws cloudfront

How does AWS CloudFront Delivers the Content?

Now that we have talked about what is AWS CloudFront and explored its features and added benefits that it offers to its customer making their experience with AWS CloudFront seamless, this section would learn how AWS CloudFront Delivers Content to its customers.

When a user puts in the content in the Amazon S3 Bucket or HTTP Server is set up with the content uploaded on it, an AWS CloudFront distribution needs to be created to tell the AWS CloudFront where the content needs to be delivered and in addition to the details about tracking and managing the content delivery. From there, the AWS CloudFront uses its edge servers that are generally in close connection to the users/viewers so that the content is delivered quickly whenever the consumer accesses it.

Now below we have listed the flow of the Content being Delivered by the AWS Cloudfront to its users:

Step 1: First the consumer while accessing the website, sends a get request for an object that the consumer wants to maybe download which objects, typically including web pages, images, media files, or anything that can be served over HTTP as shown below.

client access example

Step 2: Then this request is routed via the DNS routes to the nearest AWS CloudFront edge location that shall serve the user request.

Step 3: Now, at the edge location, The AWS CloudFront checks if the same object was previously asked by any of the consumers and therefore first checks the AWS CloudFront cache for the requested file as shown below.

serve user request example

Step 3a: If the object is found in the cache, then it returns it to the user, and hence caching at the AWS Cloudfront helps to reduce latency and make the delivery of content faster as shown below.

cache file cloudfront example

Step 3b: If the object is found in the cache, then the following steps are taken to fetch the content.

Step 3b-1: The AWS CloudFront compares the user request along with the specifications and forwards it to the applicable origin server for that specific file type as shown below.

web server cloudfront example

Step 3b-2: Then, the origin servers send the files back to the AWS CloudFront edge location so that they can be delivered to the users who wanted that.

Step 3b-3: When the first byte for that object arrives from the origin server, the AWS CloudFront starts to forward the same byte to the consumer of the content in addition to keeping adding the files to the cache part in the edge location (in case if someone again requests for the same file for the next time) as shown below.

share file example

Step 3b-4: The files sit in the edge cache for 24 hours or the specified duration in file headers while the AWS CloudFront forwards the next request for the files to the consumer's origin server. This way the AWS Cloudfront also checks if the consumer's edge location is containing the files' updated version or not.

Step 3b-5: Once, the edge location is found to contain the updated version of the file that the consumer was asking for, then the AWS CloudFront delivers it to the consumer.

Step 3b-6: But when the edge location is not found to contain the updated version of the file, then the origin server sends the latest version to AWS CloudFront after which the AWS CloudFront delivers that file to the consumer in addition to storing the latest version of the file in the cache storage at that edge location.

How to Create a Distribution Network for CloudFront?

Now we shall be seeing how we can create a Distribution Network for AWS CloudFront as given below:

Step 1: First visit the AWS Management Console and sign in with your credentials (username and password). Search for the AWS CloudFront console and open the link. Now select the Get Started button in the web section of Select a delivery method for your content page as shown below:

aws cloudfront console

Step 2: Click on the Create Distribution button as shown below. selecting create distribution button options

Step 3: Now on the web section of the Create Distribution Wizard, you need to click on the Get Started button as shown below.

select delivery method options

Step 4: Then you need to enter all the specific details that are asked for the AWS CloudFront distribution and save it.

Step 5: Once the distribution gets created, you will see that the Status column will get updated from In-Progress to Deployed.

Step 6: Now by selecting the enable the distribution option, the CDN will get ready for processing the request and the Status will be switched to the Deployed mode.

AWS CloudFront Pricing

When we talk about the Pricing that AWS CloudFront charges for using the service ranges into three plans i.e.,

  • Free Tier,
  • On-demand,
  • Discounted Pricing.

Free Tier: For Free tier prices that AWS CloudFront offers, you can get started with AWS CloudFront for free. New AWS customers receive 50 GB Data Transfer Out and 2,000,000 HTTP and HTTPS Requests, and 2,000,000 CloudFront Function invocations per month for one year.

On-demand pricing: When we speak about the On-demand pricing options that AWS Cllufront offers, the charges are based on actual usage of the service in four areas:

  1. Invalidation Requests
  2. Field-Level Encryption Requests
  3. Data Transfer out (internet/origin)
  4. Http/https Requests Where
  • Invalidation requests: It costs no fee for the first 1,000 paths requested for invalidation per month. After which, CNY 0.03355 per path was requested for invalidation.
  • Field Level Encryption requests: Charged for the number of requests that need the additional encryption; like you need to pay CNY 0.000013 for every 10,000 requests that AWS CloudFront encrypts by using its field-level encryption in addition to the standard HTTPS request fee.
  • Origin Server to Amazon CloudFront): When we use the origin server (Amazon S3, Amazon EC2, Elastic Load Balancing, etc.) or our origin serves to capture and store the data and its versions for content delivery while implementing the AWS Clufront, the for AWS China origin, there is no additional cost for data transferred from origin to edge locations. But if you use non-China Amazon Web Services origin then you get charged at the standard Data Transfer rates according to the region for the data transferred from origin to edge locations (Amazon CloudFront "origin fetches").
  • DATA TRANSFER OUT (INTERNET/ORIGIN) - Amazon CloudFront to the Origin Server: When data is transferred out AWS CloudFront to the origin server, like a 'PUT' and 'POST' request, then you get a billed at the “Regional Data Transfer Out to Origin” rates as shown in the image below for the Regional Data Transfer Out to Origin (per GB) table.

Pricing for Regional Data Transfer Out to Internet (per GB):

Per MonthUnited StatesIndia
First 10TB$ 0.085$0.109
Next 40TB$ 0.080$ 0.085
Next 100TB$0.060$ 0.082
Next 350TB$0.040$ 0.080
Next 524TB$0.030$0.078
Next 4 PB$0.025$0.075
Next 5 PB$0.020$0.072

Pricing for Data Transfer Out to Origin (Per GB)

Per GBUnited StatesIndia
All Data Transfer$0.02$0.16

Pricing for Request Pricing for all HTTP Methods (per 10,000)

Per 10,000United StatesIndia
HTTP Requests$0.0075$0.0090
HTTPS requests$0.0100$0.0120

Origin Shield Request Pricing for All HTTP Methods (per 10,000)

Per 10,000United StatesIndia
Origin Shield Requests$0.0075$0.0090

on demand pricing list

Discounted Pricing: For customers who are willing to make certain minimum traffic commits (typically 10 TB/month or higher)

Quick Note: If your data has to be delivered with minimum traffic commitments generally for 10 TB/month or higher, then you should go for discounted pricing. To avail of the discounted pricing, you need to contact the AWS team, with appropriate plans being customized according to your requirements.

Below is the image that shows the AWS Cloudfront pricing offered by AWS:

aws cloudfront pricing

Companies Using CloudFront

Now as we understand AWS Cloudfront and its features, benefits, and pricing options, We shall be looking at which companies have started using AWS Cloudfront and are already using its advantage to reduce latency for its customer and provide them with seamless experiences.

The below image refers to some of the talked about companies that have been using the AWS Cloudfront and unleashing its benefits for providing a seamless experience to its customers:

companies-using-cloud-front

  • Bandai Namco: Started using AWS CloudFront services to deliver games across the globe.
  • Spotify: By using AWS CloudFront, Spotify can instantly provide the facility of updating new features and access to a million songs for each of its users.
  • Seven Networks: Implemented the AWS Cloudfront for its live video streaming of the Australian Open to millions.
  • Amazon PrimeVideo: Delivers solid streaming of content to its more than 18 million consumers, proving a seamless experience by making use of AWS Cloudfront for the same.
  • Canon: It enables a better user experience by using AWS CloudFront.
  • TVNZ: A leading New Zealand free-to-air TV provider, started implementing the AWS CloudFront to bring a seamless experience for its users by bringing news and entertainment coverage to more than two million New Zealanders per day.
  • Jio Saavan: Jio Saavan globally delivers about 15 petabytes of audio and video data to its subscribers with the help of AWS CloudFront offering a seamless experience.
  • Sky News: Using the AWS Cloudfront service, Sky News unifies its content enabling faster distribution to its subscribers.
  • Pooq: The only content provider in Korea implemented the AWS Cloudfront as its Content delivery network for providing real-time, cloud-based broadcasting and on-air video on demand (VOD) through the over-the-top (OTT) platform.
  • TV1-EU: Improves the latency and performance, resulting in faster content delivery by simply implementing the AWS CloudFront.
  • King: By implementing the AWS CloudFront, the King has enabled a global user base by delivering seamless game content.
  • Slack: Implemented AWS CloudFront service for providing a secure API application.

AWS Cloudfront Use Cases

Now we shall dive into a few use cases of AWS Cloudfront, which we can implement if the same scenario arises.

Static Asset Aaching: With its Static asset caching, The AWS CloudFront speeds up static content delivery by using its cache property. This improves latency, and great performance helps to scale (in/out) and lowers the load on the origin servers making the AWS CloudFront a fast and reliable experience for the viewers of the content.

Live and on-demand video streaming: With AWS CloudFront we can deliver the content over the network into two broad options: Static(pre-recorded files) and Dynamic(live stream). You can use AWS Cloudfront for on-demand streaming by using the multi-bitrate adaptive streaming in Microsoft Smooth, HLS, HDS, or MPEG-DASH formats to any device. Whereas for live stream content, it is better to first cache media fragments at the edge by using the AWS Cloudfront and later reduce the load to the origin by collapsing multiple requests for the same.

Security: For Layer 3/4 DDoS mitigation, AWS Cloudfront gets easily integrated with Amazon Shield Standard in addition to seamlessly getting integrated with Amazon Identity and Access Management (IAM) for access control. With an advanced feature like Field-Level Encryption, we can protect the sensitive data of the organization.

Dynamic content and API acceleration: With AWS CloudFront we get secure and fast API calls as its supports proxy methods (POST, PUT, OPTIONS, DELETE, and PATCH). Whenever the TLS connections with AWS customers terminate at any nearest edge location, then CloudFront makes sure to use the AWS network paths to reach the API servers securely.

Software distribution: With AWS Cloudfront, we get an advanced automatic scaling facility for downloading software updates for all global consumers. With its high availability, we can make our software available at the nearest edge location for our customers by the content delivery network. With CDN's high data transfer rates, content delivery is quite fast which eventually improves the customer experience at lower costs.

Conclusion

Some key takeaway points from the article are as below:

  • The AWS CloudFront is a fast, elastic, and reliable content delivery network (CDN) service that helps to securely deliver data, videos, applications, and APIs to AWS customers globally with low latency, high data transfer rates, and low network traffic thereby improving its performance offerings seamless experience to its customers all within a developer-friendly environment.
  • The AWS CloudFront provides a smooth low latency experience, as it's built on Amazon’s reliable infrastructure, i.e. when situations arise the AWS CloudFront re-routes the end users to the next nearest location via automatically using the edge locations.
  • The highly-secure CDN allows both network and application level protection by which the traffic and applications benefit with a variety of built-in protections such as Amazon Shield Standard that too at no additional cost.
  • The AWS CloudFront integrates very easily with major AWS services like Amazon S3, Amazon EC2, or Elastic Load Balancing, for which you won't even need to pay for any data transferred that might take place between these services and AWS CloudFront.