Definition · Cost per requestFor a monthly volume V, a fixed monthly cost F, a compute cost c per request, b bytes stored per request held for R months at p_s per gigabyte-month, and e bytes of egress per request at p_e per gigabyte, the cost per request is
F/V + c + (b·R·p_s)/10⁹ + (e·p_e)/10⁹.
The monthly total is that figure times V. Only the first term depends on V.
Keeping the four terms apart is the whole technique. A single “cost per request” tells you what you are paying; the decomposition tells you what to change, and those are almost never the same number.
V = 500 000 000 a month F = $4 000 c = 1 µ$
stored 2 000 B a request, kept 12 months at $0.023 a GB-month
egress 120 000 B a request at $0.090 a GB
term $ per request share $ a month
fixed 0.00000800 39.3% 4 000
compute 0.00000100 4.9% 500
storage 0.00000055 2.7% 276
egress 0.00001080 53.1% 5 400
------------ ----- ------
total 0.00002035 100% 10 176
Two of those rows deserve a second look. The storage row is 1 000 gigabytes of new data a month billed for twelve months, which is $276 — and it would be $552 at a two-year retention with exactly the same traffic. The egress row is 60 000 gigabytes going out of the door, which is nearly seven times the compute and the storage put together and 10.8× the compute alone.
The unit cost falls while the bill rises
Both of these are consequences of the same decomposition and they sound contradictory only if the two quantities are confused. At ten times the volume the fixed term falls to $0.00000080 and the other three do not move, so the unit cost drops to $0.00001315 — and the monthly bill rises to $65 760, because there are ten times as many requests paying it.
Example · Where the fixed term stops being the largestAt low volume the fixed charge dominates everything. It stops being larger than egress when F/V = e·p_e/10⁹, that is at V* = F ÷ egress-per-request = 4 000 ÷ 0.0000108 = 370 370 370 requests a month. Below that, the thing to optimise is the fixed cost; above it, the response body. That is an equality solved, not a curve read off a chart by eye.
What each term responds to
- Fixed — load balancers, minimum fleet, licences, the control plane. Falls per request as traffic grows and never falls in total.
- Compute — the work the request does. Reduced by making the request cheaper, and by nothing else.
- Storage — bytes multiplied by how long they are kept. Reduced by retention, by compression, or by tiering, which is the subject of the next lesson.
- Egress — bytes sent back. Reduced by sending less: smaller payloads, compression on the wire, caching closer to the caller so the bytes do not leave twice.
The reason this list is worth writing down is that a team with a cost problem almost always starts on the second line, because that is the line their tools measure. On this profile the second line is 4.9% of the bill, and halving it saves $250 a month against the $5 400 sitting in the fourth.
Example · A cache changes two terms at onceServing a fifth of requests from a cache in front of the service removes their compute and their egress from the origin — but only the second if the cache is on the other side of the metered boundary. Whether a cached response still pays egress is a question about topology rather than about hit rates, and it decides whether the saving is 4.9% of a fifth or 58% of a fifth. “Caching and Hit Rates” supplies the hit rate; this page supplies what a hit is worth.
One thing this decomposition deliberately does not do is forecast. Every term here is priced at a volume you state, and the question of what V will be in eighteen months is capacity planning under uncertainty, which this course does not cover. What it does give you is the shape: a curve that falls toward a floor made of three flat terms, and the floor is where a mature service lives.