🚀 Turbocharge Your Speed: Elevate Your Experience with AWS CloudFront! 🌐

What is Amazon CloudFront?

Amazon CloudFront is a content delivery network operated by Amazon Web Services.

Imagine Amazon CloudFront as a high-speed courier service for your website. It ensures that your web pages, pictures, and other elements load swiftly for visitors, no matter where they are. CloudFront has these special delivery hubs worldwide, and when someone wants something from your website, it's sent from the nearest hub, making everything load super fast!

How does Amazon CloudFront work?

CloudFront quickly serves content from the nearest edge location if it's already there. Otherwise, if the content is not available in that location, CloudFront fetches it from a specified origin like an Amazon S3 bucket, a MediaPackage channel, or an identified HTTP server, ensuring efficient delivery.

But what is an Amazon Edge Location?

In basic terms, think of an Amazon Edge Location as a rapid-access hub for your preferred online content. It serves as a specialized station within the Amazon CloudFront network, storing duplicates of web pages, images, and more that you encounter on the internet. So, when you visit a website, these duplicates are dispatched from the closest edge location to your location, ensuring a speedy loading experience!

And how many edge locations are there in total?

The exact number may change over time as AWS continues to expand its infrastructure, but you can check the full list here.

Finally, what exactly is a CloudFront distribution?

A CloudFront distribution is like a set of instructions for your file delivery. It tells CloudFront how to pick up and drop off your website's content to ensure it gets to users quickly and efficiently.

Creating a CloudFront Distribution for the static S3 site we created in the previous blog:

  1. Sign in to your AWS console.
  2. Navigate to CloudFront from the services panel.
  3. Click on Create distribution.
  4. In the Origin Domain, select the desired S3 bucket.
  5. Once you select the bucket, you'll notice a new button Use website endpoint; click on it as it's what AWS recommends for static websites.
  6. For this demo, leave the default settings for Origin, Default cache behavior and Function associations sections.
  7. Depending on your website needs, check the Web Application Firewall (WAF) section. I'm just going to select Do not enable security protections since this is just a demo.
  8. In the Settings section, choose the price class which suits your budget the most, I'm going to select Use North America, Europe, Asia, Middle East, and Africa since I'm based in UAE.
  9. Click on Create distribution.
  10. Go back to your CloudFront distributions list and wait until the Last modified value is not Deploying.
  11. Once the deployment is complete, click on the distribution ID and select the Origins tab.
  12. Copy the Origin domain value and paste it in the browser and you'll get you website served through AWS CloudFront!