In this article, we will see what exactly Cloudfront is in AWS and what problems it solve in developers' life.
So, let's get started...
What is Cloudfront(CDN)?
A CDN stands for Content Delivery Network.
The CDNs are the ultimate cache, and the cheapest way to serve content all around the world.
With using Cloudfront, Visitors will never access the actual web server that hosts your files, but instead, they will hit those CDN servers, helping to reduce the load.
How CloudFront works?
A CDN gets the original resource from an origin server, and as long as the origin does not change, it will continue serving its local copy of an asset.
Each CDN server is located in different continents, and depending on how the CDN is built, in different parts of a continent as well.
Benefits of CloudFront
- Provides applications, data, videos, APIs, and High-speed live video streaming that satisfies the demand
- Being near a user's network increases speed and lowers latency.
- Redundancy, if a node of the CDN fails, other nodes can handle the traffic
- Reduced costs in bandwidth and server power compared to serving all the traffic from a centralized location that might not be optimized for serving lots of traffic
- Cost Effective & Support Encryption and HTTPS
- Security by adding additional levels of protection at the CDN node level. Not all CDNs do this, but most do and also introduce DDoS attack protection mitigations
CloudFront in AWS
We host data on S3 on AWS and let's say that the majority of our users access files from India while our S3 bucket is located in the US region.
Therefore, each time a user submits a request, the request must travel a great distance to the server located in the United States, adding to the processing time.
How can we make it quickly?
In this scenario, for the initial request of data/file from India, it will retrieve data from the S3 bucket-origin server(US), and then cache the same data/file in the server located in India.
Additional requests for the same data or file will be fulfilled by Indian CDN servers.
This will result in faster data access with less latency.