CDN vs direct egress cost: serve through a CDN or straight from origin?
Serving files straight from S3 or a load balancer charges full egress rates on every byte; a CDN caches content at the edge, cutting origin egress and often charging less per GB. The break-even depends on cache hit ratio and traffic. Here is the math.
Quick answer
Serving content directly from origin (S3, a load balancer, or an instance) charges full data-transfer-out rates, around 0.09 dollars per GB on AWS, on every byte served. A CDN caches content at edge locations, so most requests are served from cache and never touch origin egress, and CDN egress often costs slightly less per GB (CloudFront around 0.085 dollars per GB, less at volume). The CDN wins whenever content is cacheable and repeatedly requested, because a high cache hit ratio slashes origin egress. So use a CDN for cacheable, high-traffic, or globally-distributed content, and serve direct only for low-volume or entirely dynamic, uncacheable responses.
Every byte you serve to users costs egress, and how you serve it changes both the rate and how many bytes leave your origin. Serving directly from S3, a load balancer, or an instance charges full data-transfer-out on every request. A CDN sits in front, caching content near users so repeat requests never reach your origin. For cacheable content at any real traffic level, that difference is large.
How the two bill
| Factor | Direct egress | CDN |
|---|---|---|
| Per-GB rate | Around 0.09 dollars (AWS DTO) | Around 0.085 dollars, less at volume |
| Origin egress | Every byte, every request | Only cache misses |
| Cache offload | None | High for cacheable content |
| Best for | Low volume, fully dynamic | Cacheable, high-traffic, global |
Directly serving 100 TB a month at 0.09 dollars per GB is roughly 9000 dollars in egress. Put a CDN in front with a 90 percent cache hit ratio and only 10 percent, 10 TB, hits origin egress, while the 100 TB served to users flows over CDN egress at a slightly lower and volume-discounted rate. The origin transfer collapses, and the total drops well below serving direct, as the cache hit ratio guide explains.
Why cache hit ratio is the lever
The CDN's saving comes almost entirely from offloading origin egress, and that offload equals the cache hit ratio. At 90 percent hit ratio, origin egress falls by 90 percent; at 50 percent, only half. Static assets, images, video, and downloads cache well and get high hit ratios, so they benefit most. Purely dynamic, per-user responses cache poorly, so a CDN saves little egress on them, the same dynamic behind broader egress optimization.
When to serve direct
For low traffic, the CDN's per-GB rate advantage is small and the origin egress you would save is modest, so a CDN may not be worth the added configuration. And for entirely dynamic, uncacheable content, a CDN cannot offload much, so you pay CDN egress without the cache benefit. In those cases serving direct is simpler and similarly priced, though a CDN can still add security and latency benefits worth considering, per the CDN cost comparison.
Choosing on total cost
Estimate your traffic volume and how cacheable the content is. High-traffic, cacheable, or globally-distributed content almost always costs less through a CDN because the cache offload slashes origin egress and CDN egress is cheaper at volume. Low-volume or fully dynamic content can serve direct. Price both paths, origin egress versus CDN egress at your expected hit ratio, against the resource catalog so the break-even is a real number before you architect delivery.
FAQ
Is a CDN or direct egress cheaper?
For cacheable, high-traffic content, a CDN is almost always cheaper because it caches content at the edge, so most requests never touch origin egress, and CDN egress often costs slightly less per GB with volume discounts. For low-volume or entirely dynamic, uncacheable content, direct egress can be similarly priced and simpler, since a CDN cannot offload much cache in those cases.
How much does a CDN save on egress?
The saving roughly equals the cache hit ratio. Serving 100 TB a month direct at 0.09 dollars per GB is about 9000 dollars in origin egress; a CDN with a 90 percent hit ratio sends only 10 percent to origin, collapsing origin egress by 90 percent while serving users over cheaper, volume-discounted CDN egress. Higher cache hit ratios yield larger savings.
Why does cache hit ratio determine CDN savings?
Because a CDN saves money mainly by offloading origin egress, and the offload equals the fraction of requests served from cache. At a 90 percent hit ratio, origin egress falls 90 percent; at 50 percent, only half. Static assets, images, video, and downloads cache well and benefit most, while purely dynamic per-user responses cache poorly and save little egress.
When should I serve content directly instead of through a CDN?
For low-traffic content, where the per-GB rate advantage is small and the origin egress you would save is modest, so a CDN may not justify the added configuration; and for entirely dynamic, uncacheable content, where a CDN cannot offload much and you pay CDN egress without the cache benefit. A CDN can still add security and latency value worth weighing separately.
How does C3X help compare CDN and direct egress cost?
C3X prices both delivery paths from Terraform before you deploy, the origin data-transfer-out of serving direct versus the CDN egress and reduced origin transfer at your expected cache hit ratio. That makes the break-even a concrete number in the pull request, so you can choose a CDN or direct serving on total cost at design time rather than discovering egress charges on the bill.
What to do next
Compare CDN and direct egress cost before you architect delivery. C3X reads your Terraform and prices your resources against a live catalog. Start with the quickstart.
Share this post
Try C3X on your own Terraform
Free and open source. No API key required. One command to install, one command to estimate.