What is Amazon CloudFront and How does it work? (Hands-on)
A Distributed CDN Service
What is AWS CloudFront?
CloudFront is a distributed content delivery network (CDN) service, for faster access to your static websites, which are performed with the help of AWS Edge locations, with low latency, high speed, and faster access to your multi-media files.
Amazon launched this service in 2008, from then it had high usability among customers, higher availability is one of the core features of CloudFront.
CloudFront also ensures it has an extra layer of security mainly it secures your websites do not effect under any DDOS attacks (Distributed Denial of service)
What are Edge Locations?
Edge Locations are also called POP (Point of Presence), and Aws currently had like 410+ locations and AWS has planning to even increase more of its Pop's to higher availability, to its customers.
So what is it, it is simply a data center that is located close to the end-user geographic location. This is also the backbone of AWS global infrastructure, these edge networks.
The purpose of edge locations is to store requested sites data, once it comes It is through an authorized device or user.
How pop( Edge Locations ) and CloudFront work together?
Let's say for example when the user enters ieee.org while his in Canada, imagine the web page is stored in the S3 bucket(It's a storage service offered by AWS) in the country of India.
So this is how it works, first, the request goes to the nearest edge location or edge network, then this request is forward to the main origin which the webpage originally stored then it retrieves the page from the s3 bucket
This forward site data goes through which location is requested obviously it's edge location (here where the real magic happens), the site data before going to the end user the copy of requested data is stored in the edge location in the form of a cache.
When next time any user nearby that edge location requests the data, the request will not go to India again, it goes asks near by edge network(edge location) this time it has the data so the requested data is served fast.
What are some of its use cases?
🔵 Big tech companies get 1000s to millions of requests per second in that case going with CloudFront is a good decision.
🔵 Customers will be satisfied because of its low latency, it happens through using the CDN service.
🔵 Higher availability of high POP's (Point of presence)
A DEMO on How do you integrate AWS S3 with CloudFront?
To do this follow the below steps.
⚡ Step1: Create an AWS S3 Bucket and click on it.
You creating an S3 bucket to store our static web page assets.
⚡ Step2: Enter the Bucket name of your choice, and select the region.
⚡ Step3: Click on create a bucket.
⚡ Step4: Click on the Bucket name which you created.
⚡ Step5: Click on Upload to store your web assets in the S3 Bucket, if you did not have you can use my GitHub repo
First, you clone the repo and upload the assets to S3 simply.
⚡ Step6: Go to the Search bar and type CloudFront and choose it.
⚡ Step7: Click on Create Distribution
⚡ Step8: Choose your S3 Domain origin
⚡ Step9: Give your root home page name (You can give any of your choice), and tap on create distribution
⚡ Step10: it takes 5-10 minutes to deploy the service, If you follow the above steps correctly, tada 😃 the distribution will be created successfully, copy the domain name, and paste it into a new tab.
Here you go🚀
Thank you for reading my blog. Feel free to connect me on LinkedIn or Twitter, see you with another one. 😊