AWS CloudFront — CDN for your ALB

Intermediate
⏱️ 12 min read
📚 Updated: Aug 2025
CDN / Route 53 / ALB

What you’ll learn

AWS CloudFront is Amazon’s content delivery network (CDN). It can improve performance, scalability, and global reach for web apps by caching at edge locations and terminating viewer TLS closer to users.

This guide walks through integrating CloudFront with an existing Application Load Balancer (ALB) that already serves your domain via a Route 53 hosted zone.

Prerequisites

Before you begin, ensure you have the following:

  • An AWS account with access to CloudFront, Route 53, and your ALB.
  • An ALB already serving traffic for your domain (DNS in Route 53 pointed at the load balancer or a stable hostname you can reference as the origin).
  • For custom domain names (alternate domain names / CNAMEs) on CloudFront with ACM, public certificates must be requested in the US East (N. Virginia) us-east-1 Region, per AWS requirements for CloudFront.

Create a CloudFront distribution

Follow these steps in the AWS console.

  1. Open the AWS Management Console and go to CloudFront.

  2. Choose Create distribution.

    CloudFront console Create distribution
    AWS Management Console
  3. Under Origin, set Origin domain to your Application Load Balancer. Set the Origin protocol policy to match how viewers reach CloudFront (commonly HTTPS only or Match viewer, depending on your TLS setup).

    CloudFront origin domain and protocol policy
    CloudFront
  4. Set Minimum origin SSL protocol to at least TLS 1.2 (avoid deprecated protocols for origins).

    CloudFront minimum origin TLS version
    CloudFront
  5. Under Default cache behavior, choose Viewer protocol policy (for example redirect HTTP to HTTPS) and Allowed HTTP methods appropriate for your app (GET/HEAD or all methods if you need APIs).

    CloudFront default cache behavior settings
    CloudFront
  6. Under Cache key and origin requests, use the console recommended settings or pick a cache policy and origin request policy that match how much of the request should affect the cache key (query strings, headers, cookies).

    CloudFront cache key and origin request policies
    CloudFront
  7. Under Web Application Firewall (WAF), enable protections if you want AWS WAF in front of this distribution (optional; may add cost and requires a web ACL).

    CloudFront WAF security options
    CloudFront
  8. Under Settings, choose Price class (for example all edge locations or a smaller set), add Alternate domain name (CNAME) if needed, and attach a custom SSL certificate from ACM in us-east-1 when using a custom domain on CloudFront.

    CloudFront general settings price class and alternate domain
    CloudFront
  9. Review Supported HTTP versions and remaining defaults, then choose Create distribution.

    CloudFront supported HTTP versions
    CloudFront
  10. When deployment completes, your distribution appears as Deployed in the console.

    CloudFront distribution created successfully
    CloudFront

Monitor and configure CloudFront

  1. Return to the CloudFront console and open your distribution.
  2. Review Monitoring metrics (requests, error rates, cache hit ratio) and enable standard logging or real-time logs if you need deeper analysis.
  3. Adjust cache behaviours, TTLs, compression, and origin settings as your traffic and content change.

Update DNS records in Route 53

If the apex or hostname still points at the ALB directly, point traffic at CloudFront instead. With Route 53, an alias A (and AAAA if you use IPv6) to the CloudFront distribution is the usual approach.

  1. Open Route 53 and select your hosted zone.
  2. Edit the record for your site so the alias target is your CloudFront distribution (distribution domain name), not the ALB DNS name.
  3. Save the change and allow DNS TTL to expire for clients.

    Route 53 alias record pointing to CloudFront distribution
    Route 53

Invalidate cache (optional)

After you deploy new assets or HTML, you may need to clear cached objects so viewers see updates immediately.

  1. Open the CloudFront console and select your distribution.
  2. Open the Invalidations tab.
  3. Choose Create invalidation and enter paths (for example /index.html or /*). Use broad paths sparingly; invalidations have service limits and cost considerations.

    CloudFront create cache invalidation
    CloudFront

Key takeaways

1

CloudFront sits in front of your origin (here, an ALB) and caches responses at the edge for lower latency.

2

Tune cache and origin request policies, TLS to the origin, and viewer protocol policy for security and hit ratio.

3

Use Route 53 alias records to CloudFront; use invalidations when you must bypass cache for specific paths.

Frequently asked questions

AWS CloudFront is a CDN that delivers content through a worldwide network of edge locations. It integrates with AWS origins such as S3, API Gateway, and load balancers.
Yes. Use the ALB DNS name as a custom origin, configure origin protocol and TLS settings, and ensure security groups and health checks allow traffic from CloudFront to your targets.
Invalidations remove objects matching the given paths from edge caches so the next viewer requests fetch fresh content from the origin. Prefer versioned filenames where possible to reduce reliance on invalidations.

Next: object storage

Create an S3 bucket, upload files, and understand how public read policies differ from private origins fronted by CloudFront.

Amazon S3 — buckets and public objects →
Did you know?

CloudFront serves content from edge locations worldwide. Cached responses are returned close to viewers; cache misses and dynamic requests are pulled from your origin (here, an ALB) with latency that depends on origin geography and tuning.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful