networking

Amazon CloudFront

The CDN that turns an S3 bucket into a production website — edge caching, HTTPS, and a custom domain in front of an origin. Here's what CloudFront is good for, what it costs, how it connects to S3, ALB, and Lambda@Edge, and the mistakes Design Beaver catches as you draw.

Updated July 12, 2026

What CloudFront is

CloudFront is a content delivery network — it caches your content at edge locations worldwide, so a visitor in Singapore fetches it from a nearby location instead of round-tripping to your origin in Virginia every time. For a static site, it’s the piece that turns “an S3 bucket serving files” into “a production website”: it adds HTTPS, caching, and a real custom domain on top.

Design Beaver models CloudFront as a global edge network with no VPC or subnet — nesting it inside a subnet is misleading, so it doesn’t let you. It validates as you draw which services can be a CloudFront origin and how each of those edges has to be set up to be correct.

When to use CloudFront (and when not to)

Reach for CloudFront on any publicly accessible production site or API that benefits from caching, HTTPS, and global low latency. The most common case: you need HTTPS on an S3-backed static site, and S3 website endpoints don’t support it directly — CloudFront is the fix, not a bucket setting. It’s also the standard way to add a custom domain with TLS in front of an ALB, EC2, or API Gateway origin.

Don’t reach for it on purely internal or private tools with no public traffic and no need for edge caching. It’s also the wrong layer for content that changes on every request with nothing cacheable and no specific need for the HTTPS or edge piece — a plain ALB may be simpler there.

Variants: price classes

CloudFront’s “variants” are price classes — the dial between how many edge locations serve your traffic and how much you pay. The default is every global edge location; the narrower classes trade some geographic reach for lower cost.

OptionWhat it is
Price Class 100Cheapest option — serves from US, Canada, Mexico, and Europe edge locations only.
Price Class 200Adds US, Europe, Middle East, Africa, and Asia-Pacific (excludes South America).
Price Class AlldefaultAll global edge locations — best performance, highest potential cost.

CloudFront pricing

You pay for data transfer out to viewers plus HTTP(S) requests. The important nuance: data from an AWS origin — S3, EC2, ALB, API Gateway — into CloudFront is free, so you’re only billed for the edge-to-viewer leg.

Pay for data transfer out to viewers + HTTP(S) requests. Data from AWS origins (S3, EC2, ALB, API Gateway) into CloudFront is free. Flat-rate bundle plans also exist as an alternative to pay-as-you-go.

OptionRepresentative rate
price-class-all$0.085/GB for the first tier (US/Europe), decreasing at volume down to roughly $0.02/GB at large scale

Free tier

  • 1 TB/month data transfer out (Always Free)
  • 10,000,000 HTTP(S) requests/month (Always Free)

Keeping the bill down

  • Pick the narrowest price class that covers your real traffic geography
  • Cache aggressively (long TTLs on immutable static assets) to cut both origin load and repeat data-transfer cost

US/Europe rates shown; South America is roughly 2x this tier. Rates as of 2026-07. Verify at the official pricing page before using for real cost estimates — pricing tiers and flat-rate bundle terms change.

How CloudFront connects to other services

A CDN box on a canvas hides the real work — which service is the origin, and what that origin edge actually requires to function. Design Beaver models each CloudFront connection, so it knows what can be an origin and what that connection needs to be correct.

  • S3

    CloudFront uses an S3 bucket as its origin (standard static-site setup)

  • CloudFront Functions or Lambda@Edge for request/response manipulation at the edge (e.g. redirects, header rewriting, auth checks)

  • EC2

    CloudFront uses an EC2 instance (directly, or via an ALB) as a custom HTTP(S) origin — e.g. a dynamic app server or API in front of which CloudFront adds caching, HTTPS, and a CDN layer

  • CloudFront uses the ALB as a custom HTTP(S) origin, adding edge caching, HTTPS, and a CDN layer in front of the app server tier the ALB fronts

  • CloudFront uses a Regional API Gateway endpoint as a custom origin, adding edge caching, a custom domain, and WAF in front of the API

What CloudFront can’t connect to

Some edges look reasonable on a canvas but don’t exist in AWS. Design Beaver flags them instead of letting you draw a diagram that can’t be built.

  • RDS

    CloudFront is an HTTP(S) edge cache/CDN in front of an origin — it has no direct database client relationship; RDS is never a CloudFront origin

  • Same as RDS — not a valid CloudFront origin type

  • DNS resolution happens before traffic ever reaches CloudFront, not as a connection from it — Route 53 points at a CloudFront distribution, never the other way around

Anti-patterns Design Beaver catches

These are the CloudFront mistakes that pass a diagram review but undercut the reason you added CloudFront in the first place — the ones the validation engine flags as you draw.

CloudFront distribution with an S3 origin using a public bucket policy instead of OAC

Why it breaksSame issue as the S3 anti-pattern this mirrors — bypasses CloudFront's caching/HTTPS benefits since the bucket is reachable directly, and is unnecessary once CloudFront is in front

Do this insteadUse Origin Access Control (OAC); keep the S3 bucket's Block Public Access enabled

Using Price Class All for a site with only regional traffic

Why it breaksPays for edge locations that serve no real users

Do this insteadMatch the price class to where actual traffic originates (100 or 200 cover most cases)

Gotchas that bite in production

  • A public S3 bucket policy defeats the point of CloudFront. If the S3 origin uses a public bucket policy instead of OAC, you’ve paid for CloudFront but left the direct S3 door open — visitors and bots can bypass the CDN entirely. Use Origin Access Control and keep Block Public Access on.
  • Price Class All is the tutorial default, not always the right one. Most tutorials show the widest price class, but if your users are all in one region, you’re paying for edge locations nobody uses. Match the class to where traffic actually originates.
  • Data into CloudFront from an AWS origin is free. You only pay the edge-to-viewer leg, not the S3, EC2, ALB, or API Gateway origin fetch — worth knowing before you model transfer costs.
  • Lambda@Edge is not standard Lambda. Functions attached to CloudFront events have no VPC support and tighter execution limits that depend on which viewer-request or response event they run at. Don’t carry standard-Lambda assumptions into an edge function.
  • Front a Regional API Gateway endpoint, not an edge-optimized one. An edge-optimized API Gateway endpoint already sits behind an AWS-managed CloudFront distribution, so putting your own in front is redundant — use a Regional endpoint as the origin instead.

Further reading

Frequently asked questions

When should you use Amazon CloudFront?
Use CloudFront for any public-facing production site or API that benefits from caching, HTTPS, and global low latency — most commonly as the CDN in front of an S3 static site, since S3 website endpoints don't support HTTPS directly. It's a poor fit for purely internal tools with no public traffic, or content that changes on every request with nothing cacheable and no specific need for the HTTPS/edge layer, where a plain ALB may be simpler.
How do you connect CloudFront to an S3 bucket correctly?
Use Origin Access Control (OAC) on the S3 origin and keep the bucket's Block Public Access on. That forces all traffic through CloudFront and keeps the bucket private. Pointing CloudFront at a public bucket policy instead is the anti-pattern Design Beaver flags — it leaves the bucket reachable directly, so visitors and bots can bypass the CDN entirely.
Can CloudFront use a private ALB or EC2 instance as an origin?
Yes, with a CloudFront VPC origin. An internet-facing ALB works as a custom origin directly, but for a fully private ALB or EC2 instance, a CloudFront VPC origin lets traffic reach it without exposing it to the public internet. Design Beaver checks that requirement as you draw the connection.
Does CloudFront connect to Route 53, RDS, or DynamoDB?
No. CloudFront is an HTTP(S) edge cache in front of an origin, so RDS and DynamoDB are never valid CloudFront origins. Route 53 points a DNS record at a CloudFront distribution, never the other way around — DNS resolves before traffic ever reaches CloudFront. Design Beaver flags all three as invalid edges.
How much does CloudFront cost?
CloudFront bills for data transfer out to viewers plus HTTP(S) requests, and data from AWS origins like S3, EC2, ALB, and API Gateway into CloudFront is free — you only pay the edge-to-viewer leg. There's an always-free tier for data transfer out and requests, and flat-rate bundle plans exist as an alternative to pay-as-you-go. Verify current rates on the official pricing page before estimating a bill.

Validate your CloudFront architecture as you draw

Design Beaver checks your AWS design in real time — missing queues, invalid connections, and security anti-patterns, caught before you ship. It’s live in beta, free, and runs in your browser with no account.

Open the app →

Prefer email? Get new features in your inbox:

← All supported services