Day 51: What is Amazon CloudFront?

🌍 What is CloudFront?

Amazon CloudFront is a Content Delivery Network (CDN) service offered by AWS. It delivers your content (images, HTML, CSS, JS, videos, APIs, etc.) to users around the globe with low latency and high transfer speed.


βš™οΈ How Does CloudFront Work?

CloudFront works by caching content in edge locations (also called Points of Presence or PoPs) around the world. When a user requests your content:

  1. CloudFront checks if the content is already cached in the nearest edge location.

  2. If it is βœ… – it serves it directly, reducing load time.

  3. If not ❌ – it fetches the content from the origin server (e.g., S3 bucket, EC2, ALB) and caches it for future use.


🧩 Key Components

ComponentDescription
OriginThe original source of content (S3, EC2, ALB, or even a non-AWS server)
Edge LocationsGlobal PoPs where CloudFront caches content
DistributionThe setup that defines how CloudFront should deliver content
Cache BehaviorRules for how specific content is cached or fetched

πŸš€ Benefits of CloudFront

  • 🌐 Global reach with 400+ edge locations

  • ⚑ Low latency content delivery

  • πŸ” Security with HTTPS, AWS WAF & Shield

  • πŸ›‘οΈ Supports signed URLs and Geo-restriction

  • πŸ’Έ Cost-effective by reducing origin load


πŸ› οΈ Common Use Cases

  • Hosting static websites (e.g., React apps from S3)

  • Delivering media content (videos, images)

  • Serving APIs with reduced latency

  • Protecting backend services with Edge security


πŸ’° CloudFront Pricing Overview

You’re charged for:

  • 🌐 Data transfer out from edge to user

  • πŸ“₯ Requests (HTTP/HTTPS GET, POST, etc.)

  • πŸ’Ύ Invalidation requests (if you manually clear cache)

⚠️ Tip: Use S3 + CloudFront for static website hosting with optimal speed and cost efficiency.


🧠 Summary

CloudFront supercharges your content delivery. It brings your files closer to users, ensures faster page loads, reduces server strain, and adds a layer of global scalability and security.

Today, I configured a CloudFront distribution with an S3 bucket origin and understood how caching behaviors can be customized using the AWS console and CLI.


πŸ“Œ Next Steps:
How to host a website using cloudfront and S3

0
Subscribe to my newsletter

Read articles from Shaharyar Shakir directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shaharyar Shakir
Shaharyar Shakir