CloudFront is an Amazon web service offering that helps in improving the speed of distribution of static and dynamic web content, which includes .html, .css, .js, and image files to the users. CloudFront helps in delivering user content via a worldwide network of data centres known as ‘edge locations’. When a request comes in from the user which is being served by CloudFront, the user gets routed to an edge location which provisions lowest latency so as to deliver the content requested with best performance.
If the content requested is already present in the ‘edge location’ with lowest latency, CloudFront delivers it immediately.
If the content requested is not present in the edge location, CloudFront makes it a point to retrieve it from the origin which was defined by the user (like an Amazon S3 bucket, a MediaPackage channel or a HTTP server) and deliver it to the requested source.
CloudFront speeds up the process of distributing the content requested by user by routing every request via the AWS backbone network to the edge location which can serve the content in the optimal way. This is achieved with the help of a CloudFront edge server which provisions quick delivery of content to the viewer. This is done with the help of AWS network since it dynamically reduces the number of networks through which the user’s request needs to pass through, thereby improving the performance. This way low latency and higher data transfer rates are achieved.
The reliability and availability also improve since the copies of the files (known as objects) would be held (cached) in multiple edge locations all over the world.
A CloudFront distribution can be created to inform CloudFront about the location where the content needs to be delivered from, in addition to details regarding tracking and managing the delivery of the content. CloudFront uses edge servers which are located near to the viewer to deliver content quickly when a request comes in.
Below is an image that shows the same:
Below are the steps that need to be followed to deliver content to user with the help of CloudFront:
The ‘origin servers’ has to be specified, similar to an Amazon S3 bucket or a HTTP server. From this location, the CloudFront gets the users files, which will further be distributed from the CloudFront to edge locations all over the world.
An origin server stores the original and defined version of the user objects. If the content is being served over HTTP, the origin server can either be an Amazon S3 bucket or a HTTP server such as a web server. The HTTP server can be run on an Amazon Elastic Compute Cloud (EC2) instance or a server which is managed by the user. These servers are also known as ‘custom origins’.
If Adobe Media Server RMTP protocol is used to distribute the media files based on the requirement, the origin server will always be an Amazon S3 bucket.
The files can be uploaded to the origin servers. These files uploaded by users are also known as objects, which can be web pages, images, or media files, or anything that can be served over a HTTP protocol or a supported version of Adobe RMTP, which is the protocol used by Adobe Flash Media Server.
If the user is using an Amazon S3 bucket as the origin server, the user can convert the objects in the S3 bucket to be publicly readable, so that any person who has the CloudFront URLs for the objects is able to access them. The objects can be kept private and rules can be defined to control who has access to these objects.
A CloudFront distribution can be created, which explains to the CloudFront about which origin server needs to be communicated to, that has the ability to get the files requested by the user via a website or an application.
The user also specifies details regarding whether or not they want CloudFront to log in all requests and whether or not they want the distribution to be enabled right after it has been created.
A domain name is created by CloudFront for the new distribution which can be viewed in the CloudFront console or which is returned as a response to the programmatic request sent by user in the form of an API request. The user can alternatively add another domain name as well.
The distribution’s configuration is sent by CloudFront to all of its edge locations or points of presence (POPs). This configuration doesn’t include the content of data. This POP is a collection of servers which is present in many geographically diverse data centres where CloudFront caches the copies of the user files. The amount of time for which these cached files stay in the CloudFront edge location can be configured. By default, every file stay in an edge location for 24 hours before it gets expired. The minimum expiration time is 0 seconds, but there is no limit on the maximum expiration time.
It can used via the AWS Management Console, an API, AWS CLI, AWS Tools for Windows PowerShell or AWS SDKs.
In this post, we understood how CloudFront works to serve user requests in an efficient manner.
Whoever has contributed to this article...I would like to say thank you... it has been of good help to the readers.
This blog is very helpful and informative, and I really learned a lot from it.
It is very helpful and very informative, and I really learned a lot from this article.
Such a very useful article. I would like to thank you for the efforts you made in writing this awesome blog.
Very useful and awesome blog!