Help to lower AWS bill: Cloudfront requests for files that don't exist

· Amazingly Brilliant Pty Ltd ·

2 min read Original article ↗

Some horrible AWS request numbers

On October 17th alone, I had 4,226,132 requests to files on a website hosted on Cloudfront. AWS charged me $5.07 for these requests.

Almost all of these requests are actually to files that don’t exist. I’m sending back a 404 error (and, since they’re all images, a tiny valid image that is a very annoying flashing pixel so they’re visibly annoying).

I do not have control of where these files are being requested from. I think they’re coming from television set-top boxes (based on what the files used to be - logos for sports television channels - and what AWS reports). I can’t do anything to stop them being linked-to. They’re from domestic IP addresses.

Total bytes served from these non-existent images on Oct 17th was 4.42GB. I’m serving them with immutable headers; but as you can see, since they’re all 404 errors, they’re neither “hits” nor “misses”. (Zero bytes from “misses”, incidentally.)

This is equivalent to $150 a month on my Cloudfront bill, to serve images that don’t exist to devices I have no control over.

All files like this are served, from my origin, by one page on my Lightsail instance in eu-west-1. I’m using Origin Shield to help protect the server. I’m not using WAF (since that’s charged on a per-request basis as well). I’m not using a plan.

Is there a way I can stop paying for 404 errors being served like this, or to decrease my costs?

I’d very much appreciate some pointers to help. I’ve posted this on Reddit’s /aws subreddit - it might get moderator approval, and if so it’s here - or, I’m at james@crid.land


And the answer appears to be (thank you, Ivan)…

You get WAF for free with a Cloudfront package. So… a) switch to the $200 a month (gulp!) package. b) configure WAF, which is now free, to reject those files at the WAF c) since these file requests don’t count for the usage limits, you’ll be able to downgrade to the $15 a month package. d) just remember to downgrade, James.

So that’s what I’m doing. I’ve also shifted this website to a free plan (because I can); discovered $40 of WAF usage for Podnews that I wasn’t using, so hopefully saved that amount of money as well; and may potentially shift Podnews itself onto a plan as well once I’ve worked out if it would be a saving.

AWS costs

More posts about: