Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages

Help for owners

My CDN bandwidth bill is much higher than I expected

Short answer

A CDN bill grows with the data it sends out and with the requests it passes back to your server. Short cache times, cookies or query strings in the cache key, and very large files all lower the cache hit ratio and raise the bill. Look at the cache statistics and the biggest files before changing anything.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Does this sound like your situation?

  • Data transfer is the biggest line on the invoice.
  • The bill rose after a redesign, a campaign, or adding videos.
  • My server load went up even though a CDN sits in front.
  • Traffic numbers look normal but the charge does not.
  • I do not know which files are responsible.

Why does this happen?

  1. A low cache hit ratio

    AWS explains that the more requests are served straight from the CloudFront cache instead of going to the origin, the better the cache hit ratio. Shorter cache durations send more requests to the origin, so AWS suggests the longest practical max-age.

  2. Query strings, cookies or headers split the cache

    If the cache key includes query strings, cookies or headers, each combination of values is cached separately, even when the files are identical. AWS gives examples such as parameters in a different order or case, forwarding every cookie, and caching on the User-Agent header.

  3. Some content is not cached at all

    Cloudflare does not cache HTML or JSON by default, and it does not cache a response that has Cache-Control of private, no-store, no-cache or max-age=0, or that sets a cookie. Content sent with such headers goes to the origin every time.

  4. Large files and heavy pages

    Uncompressed images, video and big downloads move a lot of data on every visit. This is a content and design cause, not a CDN setting, and it is often the biggest.

  5. Traffic that is not real customers

    Bots, scrapers and other sites embedding your images can send large volumes of traffic. The CDN's logs show who requests what and from where.

What can I do about it today?

  1. Open the billing breakdownIn your CDN account find the usage report. Note which line grew (data out, requests, or origin transfer) and from what date.
  2. Open the CDN's cache statisticsCloudFront and Cloudflare both show cache hit information. Write down the current hit rate and the busiest URLs.
  3. List the biggest filesAsk for the top files by data sent. Large images and videos are the usual cause.
  4. Ask what changed on the bill dateA redesign, a new video, a new app release or a campaign explains many jumps.
  5. Do not switch the CDN off or delete filesSwitching off sends all traffic straight to your server and can take the site down. Deleting files breaks pages.
  6. Set a budget alert if your account offers oneMost cloud accounts can email you when spend passes a limit. Set it to your own email.

When should I bring someone in?

  • The cost keeps rising and you cannot see why.
  • Your server is overloaded as well as the CDN bill being high.
  • You suspect bots or other sites using your files.

How do I handle it?

  1. Find the biggest contributorsI rank files, paths and countries by data sent using the CDN's logs and reports.
  2. Check what is being cachedI read the response headers and the cache key rules to see why files go back to the origin.
  3. Tighten the cache keyOnly the query strings, cookies and headers that truly change the answer are kept in it.
  4. Reduce the payloadImages are resized and compressed, long cache times are set for files that never change, and the site uses versioned file names.
  5. Block abuse narrowlyIf the logs show scraping or hotlinking, I add targeted rules and keep real visitors untouched.

The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.

What do owners ask about this?

Does a CDN always lower the bill?

It lowers the load on your server. The CDN's own charge depends on how much data it sends, so large or badly cached files can still cost a lot.

Will longer caching cause old content to show?

It can, unless files have versioned names or are purged on release. See the page on a CDN serving old content.

Can I get the extra charge refunded?

That is the provider's decision. Ask their billing support, and I cannot promise an outcome.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.

For your developer: the technical fixes

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.