In this blog on Amazon CloudFront, we will read in detail about the following topics:
Check out this insightful AWS Tutorial to get you started:
Let’s begin by understanding what Amazon Cloudfront is and how it delivers content to its users.
What is AWS Cloudfront?
Amazon Cloudfront is a content delivery network (AWS CDN) that retrieves data stored in the Amazon S3 bucket and distributes it to numerous edge locations across the world. Edge locations are the network of data centers distributed worldwide through which content is delivered.
When a user requests content that is being served with CloudFront, the request is routed to the nearest edge location that gives the lowest latency. This helps the user to access content with the best possible performance. The Amazon cloud architecture functions as follows.
- If the content is already cached in the edge location, CloudFront delivers it immediately with the lowest latency possible.
- If the content is not present in the edge location, CloudFront retrieves it from the origin (like Amazon S3 bucket, a MediaPackage channel, or an HTTP server) that has been identified for your content.
Let’s now look at Amazon CloudFront and understand how it delivers content from the origin to the end-user.
Preparing for job interviews? Take a look at our blog on AWS Interview Questions and answers.
How does Amazon CloudFront deliver content?
Once an Amazon S3 Bucket or HTTP Server is set up, a CloudFront distribution is created to tell CloudFront where you want the content to be delivered and details about tracking and managing content delivery.
CloudFront then uses edge servers that are close to your viewers to deliver content quickly when someone accesses it.
Steps to configure CloudFront to deliver content :
- When the origin servers such as the Amazon S3 bucket or an own HTTP server are specified, CloudFront gets the required files which are then distributed from CloudFront edge locations all over the world.
- Files are uploaded to the origin servers. The files also known as objects, typically include web pages, images, and media files. It can include anything that can be served over HTTP.
- The CloudFront distribution tells CloudFront which origins to get the files from when users request the files through the website or application.CloudFront also logs all the requests and distribution can be enabled as soon as it’s created.
- A domain is assigned to the new distribution that can be found in the CloudFront console or an alternate domain can be used instead.
- The distribution is sent across to all the edge locations or points of presence collections that are collections of servers in geographically dispersed data centers where CloudFront caches a copy of the data.
Interested in AWS? Master Amazon Web Services by signing up for AWS Certification!
Now, let’s take a look at a few important terminologies used throughout this blog. It will help you understand the topics with more clarity.
Key Terminology in AWS CloudFront.
Edge Locations: A worldwide network of data centers that deliver content to the end-user are called edge Locations.
Latency: It is a measure of delay or time data takes to get to its destination from the source point.
Amazon Content Delivery Network (AWS CDN): A content delivery network (CDN) represents a group of servers that are geographically distributed over the globe and provide a fast delivery.
Amazon S3 Bucket: An Amazon S3 bucket is a public cloud storage resource available in Amazon Web Services.
Origin Access Identity: An Origin Access Identity (OAI) is used for sharing private content via CloudFront. The OAI is a virtual user identity that will be used to give your CF distribution permission to fetch a private object from your origin server (e.g. S3 bucket).
Since now you are familiar with the key terminology, let’s move on to the benefits of CloudFront.
Benefits and Features of AWS CloudFront
There are 216 edge locations across the globe. With the number of edge locations, it enables the end-user to use your content without any latency.
Amazon CloudFront provides a high data transfer rate since the content is already cached in the nearest edge location, it gives the end-user a lightning-fast speed delivery of the content.
It provides an option for both static and dynamic content delivery. As soon as one byte is loaded into the cache, it is immediately transferred to the client working as a Live Steam.
A highly secure application is developed without extra cost. A CloudFront inherits the features of AWS Shield Standard. The edge locations which are spread across the globe feature a 7 Layer Protection named AWS Web Application Firewall.
The whole of AWS-supported services for your content or application can be integrated into the CloudFront.
If you have any queries about CloudFront, feel free to ask in our AWS Community!
After going through the benefits, we shall extend the dimensions of the applications of Amazon CloudFront in the following section.
Amazon CloudFront Use Cases
Using the AWS CloudFront can help you accomplish a variety of goals. This section lists a few use cases to give you an idea of the possibilities with it.
Static asset caching
By using CloudFront, the advantage of AWS backbone can be obtained for your application. CloudFront gives your end users a fast, safe, and reliable experience.
Amazon S3 Bucket can be used as a simple approach for storing and delivering static content. When S3 is used together with CloudFront, an option to use Origin Access identity (OAI) can be used to easily restrict access to your S3 content.
Both pre-recorded and live events can be streamed to global viewers.
- Formats such as MPEG DASH, Apple HLS, Microsoft Smooth Streaming, and CMAF can be streamed using the CloudFront for the Video on Demand (VOD) streaming service.
- For live streaming, media fragments are cached at the edge, so the multiple requests for the manifest file which delivers the fragments in order can be combined. This method reduces the load on the origin server.
Looking to prepare for a Jobs Interview? Check out our Blog on AWS Interview Questions.
When HTTPS is configured with CloudFront, we already have secure end-to-end connections with the origin servers. Adding field-level encryption protects data throughout system processing in addition to HTTPS security, enabling only certain applications at your origin to see the data.
Now that you have an overview of what CloudFront is and its use cases. Let’s take a look at the available pricing plans.
AWS CloudFront Pricing
The Pricing for Amazon CloudFront is divided into three plans i.e., Free Tier, On-demand, and Discounted Pricing.
As part of the AWS Free Usage Tier, you can get started with Amazon CloudFront for free. Upon sign-up, new AWS customers receive 50 GB Data Transfer Out and 2,000,000 HTTP and HTTPS Requests, and 2,000,000 CloudFront Function invocations each month for one year.
The below image gives a summary of pricing options across the On-demand plan for AWS CloudFront.
If you have any doubts or queries related to this technology, do post them on AWS Community.
Pricing for Regional Data Transfer Out to Internet (per GB)
|Per Month||United States||India|
|First 10TB||$ 0.085||$0.109|
|Next 40TB||$ 0.080||$ 0.085|
|Next 4 PB||$0.025||$0.075|
|Next 5 PB||$0.020||$0.072|
Pricing for Data Transfer Out to Origin (Per GB)
|Per GB||United States||India|
|All Data Transfer||$0.020||$0.160|
Pricing for Request Pricing for all HTTP Methods (per 10,000)
|Per 10,000||United States||India|
Origin Shield Request Pricing for All HTTP Methods (per 10,000)
|Per 10,000||United States||India|
|Origin Shield Requests||$0.0075||$0.0090|
If you are willing to make minimum traffic commits of typically 10 TB/month or higher, you can avail of the discounted pricing. This can be availed by contacting the AWS team, and appropriate plans can be customized according to the requirements.
Intrigued by AWS? Go through the AWS Course in London to get a clear understanding of AWS!
The next section is hands-on to help you set up and get started with your AWS CloudFront distributions.
Setting up AWS CloudFront
To get started, the basic steps for delivering content by creating a simple AWS CloudFront distribution, using the AWS for WordPress plugin, or creating a secure static website are given in this section. Before S3 moving ahead, make sure you have set up your AWS account and created an Amazon Bucket.
Let’s begin with CloudFront for simple CloudFront distribution. Here are a few common steps to set up your AWS account and upload the CloudFront.
Step 1: Upload content to Amazon S3. If you don’t have your website content or are looking to experiment with CloudFront, use the following link to download a simple web package: hello-world-html.zip.
Step 2: In the Access Control List section, select the check box for “Read” next to Everyone (public access) in the Objects column.
Step 3: After completing the upload process of your content. You can navigate to the item by using its URL. For Example:
HTTPS://<bucket name>.s3-<AWS Region>.amazonaws.com/<objectname>
Getting started with a simple AWS CloudFront distribution
In this section, we show you how to use CloudFront to set up a basic configuration to
- Store original versions of objects in Amazon S3
- Make the objects accessible
- Store the objects in edge locations for a default duration of 24 hours
Step 1: Create a CloudFront distribution.
Step 2: Open the CloudFront console at https://console.aws.amazon.com/cloudfront/
Step 3: Choose Create Distribution, and then choose to Get Started.
Step 4: Under Origin Settings, for Origin Domain Name, choose the Amazon S3 bucket that you have created earlier.
For the other settings under Origin Settings, accept the default values.
Step 5: For the settings under Default Cache Behavior Settings and Distribution Settings, accept the default values.
Step 6: At the bottom of the page, choose to Create Distribution.
Step 7: After CloudFront creates your distribution, the value of the Status column for your distribution changes from In Progress to Deployed. (This typically takes a few minutes)
A domain name is assigned to your distribution, which appears in the list of distributions.
It looks similar to:
Step 8: Access your content through CloudFront
To access content, combine your AWS CloudFront distribution domain name with the patch to access your content.
For example, your AWS CloudFront distribution domain name looks similar to the following
Become a certified industry expert of DevOps by enrolling in this online DevOps Training in London!
Traditionally, the path to access the main page of the website is /index.html. The content can be accessed through CloudFront at a URL that looks like this :
If you have followed steps and used the simple hello world webpage, you should see the webpage’s content:
Now you have successfully configured CloudFront to serve your website’s content that’s stored in Amazon S3.
Learn more about AWS in our blog on AWS Tutorial!
Getting started with the AWS for WordPress plugin
For this section, we configure a plugin for AWS.To get started, create a WordPress website.
Before starting the configuration, follow the below steps to create an IAM user in the AWS console:
Step 1: In the navigation pane of AWS, choose Users. Then choose to Add User.
Step 2: On the Set user details page, do the following
- For Username, enter AWSFroWordPressPlugin
- For Access type, choose Programmatic access.
- Choose Next: Permissions.
Step 3: On the Set Permissions page, do the following:
- Choose Attach existing policies directly.
- In the search box, enter WordPress, and then select the check box next to AWSForWordPressPluginPolicy.
- Choose Next: Tags
Step 4: Choose Next: Review.
Step 5: Choose Download .csv to save the user’s credentials (access key ID and secret access key) to your computer. (Important as you will need to configure them for AWS for WordPress plugin)
Watch this video on Introduction to WordPress Tutorial for Beginners to get started.
If your website has a domain name and works using HTTPS, you can proceed with the following steps:
Step 6: Log in to the admin dashboard for your WordPress website, also known as WP Admin.
Step 7: Choose Plugins.
- If you have the Amazon AI or AWS for WordPress plugin:
- Check the box next to Amazon AI or AWS for WordPress.
- Choose update and then apply from the bulk action menu.
If you don’t have the Amazon AI or AWS for WordPress plugin:
- Choose Add New.
- In the search box, enter AWS for the WordPress plugin.
- Choose Install Now, and then choose Activate.
Step 9: Now, go back to your dashboard page and choose AWS on the left navigation.
Step 10: Paste or enter the access key ID and secret access key that has been saved in Step 5 and then choose Save Changes.
Step 11: In the navigation pane, choose CloudFront.
Step 12: On the CloudFront Setup page, do the following:
- If necessary, for Origin Domain Name, enter your website’s domain name, for example, example.com.
- Choose Initiate Setup.
Step 13: Add the DNS record and return to the setup page and choose Check status of SSL certificate.
Step 14: After the DNS record is enabled, return to the setup page and choose Check status of CloudFront DNS record.
Step 15: Choose Activate Site Acceleration, and then choose Save Changes.
AWS CloudFront can enhance your content delivery to the end-user and optimize their experience while using your application. AWS certification will give you good chances to explore better jobs or projects too. So, why not get benefits from becoming certified? If you are interested in learning about AWS and other concepts, then you should enroll in Intellipaat’s Cloud Computing courses.
We hope this blog has given you a complete understanding of Cloudfront and opened a new door of knowledge. If you have more queries, drop a comment below.