DevOpsLesson
DevOpsLesson

Free, comprehensive DevOps tutorials and learning roadmaps. Master Docker, Kubernetes, CI/CD, and more.

Stay Updated

Get notified about new tutorials and features.

Tutorials

  • What is DevOps?
  • Docker Tutorial
  • Terraform Tutorial
  • CI/CD Pipeline
  • All Tutorials

Roadmaps

  • DevOps Engineer
  • Cloud Engineer
  • SRE Path
  • All Roadmaps

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 DevOpsLesson. All rights reserved.

DOCKERKUBERNETESTERRAFORMAWSCI/CDLINUXGITDEVOPS ROADMAPCLOUD ROADMAPSRE ROADMAPGIT CHEATSHEETDOCKER CHEATSHEETK8S CHEATSHEETTF CHEATSHEETLINUX CHEATSHEETDOCKERFILE LINTERYAML VALIDATORCRON PARSERREGEX TESTER

Aws Tutorial

Introduction to AWS
AWS Global Infrastructure
Setting Up AWS
AWS IAM
AWS EC2
AWS VPC
AWS S3
AWS RDS
AWS Lambda
AWS ECS and EKS
AWS CloudWatch
AWS CodePipeline
AWS Cost Optimization
AWS Elastic Load Balancing
AWS Auto Scaling
AWS CloudFront
AWS Route 53
AWS DynamoDB
AWS ElastiCache
AWS SQS
AWS SNS
AWS EventBridge
AWS Step Functions
AWS API Gateway
AWS ECR
AWS EKS
AWS CloudFormation
AWS Elastic Beanstalk
AWS KMS
AWS Secrets Manager
AWS WAF and Shield
AWS CloudTrail
AWS Config
AWS Systems Manager
AWS Organizations
AWS EFS
AWS EBS Deep Dive
AWS Kinesis
AWS Athena
AWS CodeDeploy
AWS CodeCommit
AWS CDK
AWS SAM

AWS CloudFront

PreviousPrev
Next

Learn how Amazon CloudFront caches content at edge locations and accelerates access to S3, ALB, EC2, and custom origins.

AWS CloudFront is AWS's content delivery network and moves content closer to users through a global edge network. For DevOps teams, it matters because it reduces latency, offloads origin traffic, and gives DevOps teams a consistent edge layer for static and dynamic content. Instead of relying on one fragile manual configuration, you can design a repeatable service boundary that stays stable while the workload behind it changes.

CloudFront: CDN Request Flow

User Browser
DNS → nearest edge location
CloudFront Edge Location
cache check
Cache Hit
Return cached response
Cache Miss
Origin (S3 / ALB / EC2)

Cache Hit = faster response + lower origin cost

Core ideas

The main ideas to understand are CloudFront can use origins such as S3, ALB, EC2, or any custom HTTP endpoint; cache behaviours decide which paths use which origin, protocol policy, and caching rules; time to live settings control how long objects stay at the edge before revalidation or refresh; and invalidations clear cached objects when fast removal matters more than waiting for TTL expiry. These details shape architecture decisions, but they also shape day-to-day operations. When a team chooses defaults without understanding how the service behaves under failure, scale, or security review, the platform often becomes harder to debug than the application itself.

Origin typeCommon useNotes
S3Static sites and assetsSimple and highly scalable
ALBDynamic web appsWorks well with ECS or EC2
Custom HTTPExternal or hybrid backendsRequires origin reachability

From an operations perspective, the goal is to tune behaviours so popular objects stay cached while sensitive or rapidly changing responses remain correct and secure. The comparison below highlights the choices that usually matter first. It is often better to start with a simpler design and add sophistication only after metrics, incidents, or delivery requirements prove the change is necessary.

Practical commands

aws cloudfront list-distributions --query 'DistributionList.Items[].{Id:Id,Domain:DomainName,Enabled:Enabled}' --output table
aws cloudfront create-invalidation --distribution-id EXAMPLE123 --paths '/index.html' '/assets/*'

Practical CLI checks make the service easier to support in real environments. Use the commands below to inspect the current state and confirm that automation matches intent. Before you promote a change, verify cache keys, origin reachability, and whether invalidations are truly needed before paying to purge objects. A safe default is separating static and dynamic paths with different cache behaviours so each path gets the right TTL and policy. That discipline makes later troubleshooting, scaling, and security reviews far less painful.

Exercise

CloudFront role

What is the main purpose of Amazon CloudFront?

Exercise

Origins

Which service can act as a CloudFront origin?

PreviousPrev
Next

Continue Learning

AWS Auto Scaling

Learn how EC2 Auto Scaling maintains desired capacity, launches replacement instances, and grows infrastructure with demand.

18 min·Intermediate

AWS Auto Scaling Groups

Understand how to configure Auto Scaling Groups with min, max, desired capacity, health check grace periods, and instance refresh.

12 min·Intermediate

AWS Auto Scaling Policies

Learn how target tracking, step scaling, simple scaling, and scheduled actions control EC2 fleet growth in AWS.

10 min·Intermediate

Explore Related Topics

Te

Terraform Tutorials

Manage AWS infrastructure as code

Li

Linux Tutorials

Essential Linux skills for working with EC2

On This Page

Core ideasPractical commands