Expand description
Size classes: what minimumMemoryInMiB actually buys, and what it bills.
minimumMemoryInMiB does not size a VM. It selects a class, and the class has
two numbers that differ by 4x — the baseline you are billed for every running
second, and the peak the guest reports in /proc/meminfo. Measured 2026-08-07,
us-east-1: requesting 512 produced a guest reporting ~2 GB MemTotal; requesting
2048 produced ~8 GB. Both match AWS’s documented sizing table exactly, so the
number the caller writes down is neither the number they get nor, on its own,
enough to predict the bill (docs/PLATFORM.md, “minimumMemoryInMiB selects a
baseline, and the guest reports the peak”).
The peak is provisioned from the start (service team, confirmed 2026-08): there is no scaling event, nothing resizes during a run, and app code never observes a resource change. The baseline is the bill’s floor — always paid while the VM runs — and usage above it is billed by consumption.
§Why the table is data (TRAP-13)
Every documented peak is exactly four times its baseline, which makes
baseline * 4 look like the obvious simplification. It is the one thing this
module must not do. That regularity is AWS’s and not ours: a sixth row, or a
revision to an existing one, that breaks the pattern would silently get the
pattern applied to it, and the report would name a provisioned ceiling the service
does not offer. So SIZE_CLASSES is the only place any of these numbers appears, and
every accessor reads a row out of it through one lookup — which is also what makes
the guard testable: the test below drives the accessors over a table whose peak is
not 4x, and a computed implementation cannot answer it.
§Why an off-table request is refused (TRAP-10)
Only the five table values are accepted. What the service does with an off-table request such as 1500 is undocumented and unmeasured, and the two plausible behaviours — round up to the enclosing class, or take the literal as a baseline — differ in both the memory the guest gets and the rate it is billed at. Rejecting locally costs the caller a second; guessing costs them a wrong bill they have no way to notice.
Structs§
- SizeRow
- One row of the documented sizing table: a baseline and its provisioned ceiling.
Enums§
- Size
Class - One of the five documented size classes.
Constants§
- MIB_
PER_ GB - MiB per GB as AWS’s pricing and sizing tables use it.
- SIZE_
CLASSES - The documented table (
microvms-images.html), smallest first.