Skip to content

EC2 instance-type catalog carries no current-generation accelerated types, and RunInstances does not validate against it #896

Closed

Description

@scttfrdmn

The gap

ec2InstanceTypeFamilies (emulator/ec2_instancetypes.go:76-167) carries ten families — t3, t3a, m5, m5a, c5, c5a, r5, p3, g4dn, inf1 — and none of the current-generation accelerated families: no g5, g6, p4d, p4de, p5, trn1, trn2 or inf2. ec2CheckInstanceTypesExist (:241) refuses a type the catalog does not carry, so:

aws ec2 describe-instance-types --instance-types g6.xlarge
# -> InvalidInstanceType

and DescribeInstanceTypeOfferings (ec2_plugin.go:5781, which walks ec2InstanceTypeCatalog) and DescribeSpotPriceHistory (:5808) both omit it silently, since for those a type matching nothing is "zero offerings and HTTP 200" by design (:5725-5728).

Why it is being filed now

The catalog's non-exhaustiveness is a deliberate, documented decision, and the doc comment states the property that makes the refusal honest:

The catalog is deliberately not exhaustive — EC2 offers some 800 types — but it is complete per family, which is the property that makes the rest of the modeling honest. [ec2CheckInstanceTypesExist] refuses a type the catalog does not carry, so a catalog that stopped mid-family … would answer InvalidInstanceType for types that plainly exist.

The accelerated families are the one place that property does not hold, and the comment says so:

Accelerated. These are the single sizes #234 seeded rather than whole families: the accelerated families are large, their specs vary widely across sizes, and no consumer has asked for more of them.

p3 carries only 2xlarge, g4dn only xlarge, inf1 only xlarge. So p3.8xlarge — a type that plainly exists — answers InvalidInstanceType, which is precisely the failure the completeness invariant was written to prevent. The reason recorded for accepting that was "no consumer has asked for more of them." One now has: #891, #892 and #894 all arrive from a consumer whose probe target is g6.xlarge, and all three are blocked on the type before any of their own logic runs.

A second, separate asymmetry

RunInstances does not validate InstanceType against the catalog at all. ec2_plugin.go:317 reads req.Params["InstanceType"] and stores it on the instance verbatim; ec2InstanceTypeIndex has exactly one non-test reader, ec2CheckInstanceTypesExist (ec2_instancetypes.go:243). So RunInstances --instance-type g6.xlarge succeeds and DescribeInstances reports g6.xlarge, while DescribeInstanceTypes --instance-types g6.xlarge refuses the same string in the same session. Two operations disagree about whether the type exists, and the permissive one is the one that creates state.

Which way to resolve that is a real decision, not an obvious fix: refusing at launch is what real EC2 does but would break any existing fixture launching an unmodeled type, and #485 already established that substrate's and AWS's behaviour here were diffed against each other once. It should be decided explicitly rather than as a side effect of widening the catalog.

Acceptance criteria

  • Decide the scope of the widening and record it: which accelerated families, and whether each is seeded complete per family (restoring the invariant) or as single sizes (extending the documented exception). If the latter, the doc comment's "no consumer has asked" rationale is replaced by a stated one.
  • vCPU, memory and accelerator counts for each added size come from the AWS accelerated-computing instance-type guide (https://docs.aws.amazon.com/ec2/latest/instancetypes/ac.html), cited, in the same way the existing families cite gp/co/mo.
  • SpotPrice for each added size follows the existing calibration rule — "Within a family they are a fixed rate per GiB of memory, which keeps them monotonic in size" — and the eight EC2 plugin: add DescribeInstanceTypes, DescribeInstanceTypeOfferings, DescribeSpotPriceHistory #234 values stay verbatim, so no existing fixture moves.
  • GPUs is set per family, with the inf/trn decision recorded: inf1's count is deliberately zero because "real EC2 does not report [Inferentia] through gpuInfo", so inf2/trn1/trn2 follow that reading unless AWS's own DescribeInstanceTypes output shows otherwise.
  • The RunInstances-vs-DescribeInstanceTypes asymmetry above is either fixed or recorded in docs/services.md as a known divergence with its reason.
  • DescribeInstanceTypes, DescribeInstanceTypeOfferings and DescribeSpotPriceHistory all report every added type (they share the catalog, so this is one test asserting the three agree).
  • docs/services.md lists the catalog's families, since the reference is what tells a caller which types will be refused.

Notes

Blocks #891, #892 and #894 as a practical matter — each is implementable without it, but none can be exercised with the inputs its reporter actually uses. Independent of #893, which changes the location axis rather than the type axis.

Activity

  1. added
    type: feature
    status: needs-design
    on Sep 15, 2026
  2. added this to the v0.118.0 milestone on Sep 15, 2026
  3. scttfrdmn commented on Sep 17, 2026

    @scttfrdmn
    OwnerAuthor

    The four decisions this issue asks to be made explicitly, recorded before the PR.

    1. Complete per family, and which families

    Complete per family, restoring the invariant rather than extending the exception. The recorded reason for the exception — "the accelerated families are large, their specs vary widely across sizes, and no consumer has asked for more of them" — is two-thirds still true, and the PR keeps the first two clauses in the doc comment while replacing the third with what actually changed: #891, #892 and #894 arrived.

    Eleven families, forty-one types where there were three:

    Family Sizes Accelerator
    p3 2xlarge, 8xlarge, 16xlarge NVIDIA V100
    p4d 24xlarge NVIDIA A100 40 GiB
    p4de 24xlarge NVIDIA A100 80 GiB
    p5 4xlarge, 48xlarge NVIDIA H100
    g4dn xlarge … 16xlarge (6) NVIDIA T4
    g5 xlarge … 48xlarge (8) NVIDIA A10G
    g6 xlarge … 48xlarge (8) NVIDIA L4
    inf1 xlarge, 2xlarge, 6xlarge, 24xlarge Inferentia
    inf2 xlarge, 8xlarge, 24xlarge, 48xlarge Inferentia2
    trn1 2xlarge, 32xlarge Trainium
    trn2 3xlarge, 48xlarge Trainium2

    Bare metal is excluded as it is everywhere else in the catalog, which costs the table exactly one size: g4dn.metal. So "complete per family" here means the same thing it means for c5, not a weaker thing.

    Four families AWS publishes beside these are deliberately out, and the reasons differ. p3dn, trn1n, p5e and p5en are each their own single-size family in AWS's own tables (p3dn on the previous-generation page, the other three on ac.html) — omitting a whole family is what the catalog already does everywhere, and it is refused rather than half-modelled. trn2u.48xlarge is the one that needed a judgement: AWS publishes it with "✗ No" in both the Accelerators and Accelerator-memory columns, despite 2048 GiB of memory and a Trainium2-class network profile. That is almost certainly a documentation gap rather than a zero-accelerator instance, and inferring 16 from trn2.48xlarge would be substrate inventing a spec, so it stays out. g5g is out for a different reason again: it is Graviton, and buildEC2InstanceTypeCatalog hardcodes x86_64 for every entry — the first ARM family in the catalog needs that widening first, and the build function now says so.

    2. A second table, because GPUs cannot stay on the family

    The issue's fourth criterion says "GPUs is set per family". That is not possible for the families being added, and it is the one premise here that has to be corrected. AWS publishes accelerator counts that are not monotonic in size and not constant within a family:

    • g4dn, g5 and g6 each have a 12xlarge carrying four and a 16xlarge — the next size up — carrying one;
    • g5 and g6 have a 24xlarge carrying four below a 48xlarge carrying eight;
    • inf2's counts run 1, 1, 6, 12;
    • p3 runs 1, 4, 8 and p5 runs 1, 8.

    ec2InstanceTypeFamily.GPUs exists only because the catalog held one accelerated size per family, and its own doc comment says exactly that: "Sizes within a real family differ here; the catalog holds a single accelerated size per family, so one value per family is enough." The condition that made it enough is what this issue removes.

    Moving the count onto ec2InstanceTypeSize was rejected: those literals are positional across roughly sixty rows in seven general-purpose families, so a fifth field means touching every row of a table this change has no business in, to add a value that is zero in all of them. So accelerated sizes get their own row type, ec2AcceleratedSize, in a second table ec2AcceleratedFamilies, and ec2InstanceTypeFamily.GPUs is deleted.

    The invariant the split had to preserve is the one buildEC2InstanceTypeCatalog's doc comment states — "Both are built by one function so a type can never be in one and not the other", which exists because #234's parallel spot-price map silently dropped types from DescribeSpotPriceHistory. One function still flattens both tables into the single catalog and index, so the three operations cannot disagree about what is in it, and the test asserts that directly: DescribeInstanceTypes, DescribeInstanceTypeOfferings (at LocationType=region) and DescribeSpotPriceHistory (at one AZ) must return the same type list in the same order. Adding a second table is precisely the change that could have reintroduced #234's hazard, so that assertion is the one the PR leads with.

    3. inf and trn report no gpuInfo, and the reading is now on firmer ground than "unless AWS shows otherwise"

    The criterion asks that inf2/trn1/trn2 follow inf1's zero "unless AWS's own DescribeInstanceTypes output shows otherwise". They follow it, and there is a shape argument rather than an absence of evidence. InstanceTypeInfo has three separate accelerator members, quoted from the reference:

    • gpuInfo — "Describes the GPU accelerator settings for the instance type."
    • inferenceAcceleratorInfo — "Describes the Inference accelerator settings for the instance type."
    • neuronInfo — "Describes the Neuron accelerator settings for the instance type."

    plus fpgaInfo and mediaAcceleratorInfo. Substrate models gpuInfo only, so the four non-NVIDIA families render no gpuInfo element at all — not a zero count, which is what a naive fix produces and what the test pins on raw bytes.

    One thing that could not be verified and is worth recording so it is not re-researched: neither InferenceAcceleratorInfo's nor NeuronInfo's reference page states which family populates which member. Neither page's text names Inferentia or Trainium at all, and InferenceAcceleratorInfo additionally carries the note "Amazon Elastic Inference is no longer available." So modelling either member today would mean guessing where AWS puts the count — which is why the counts are recorded in the table (so it needs no research later) and nothing reports them.

    4. Spot prices, and the three seeded values

    Rates per GiB of memory, per the existing rule, with the three #234 values preserved verbatim and their families calibrated from them: g4dn 0.01175 from g4dn.xlarge 0.188, inf1 0.0095 from inf1.xlarge 0.076, and p3 0.918 per 61 GiB — which makes p3.8xlarge and p3.16xlarge exact multiples of the seeded p3.2xlarge value. The eight families with no seeded value get substrate's rates, ordered so a newer generation costs more per GiB than the one it replaces (g4dn 0.01175 < g5 0.0125 < g6 0.013; inf1 0.0095 < inf2 0.0105; trn1 0.0115 < trn2 0.0135; p3 ≈ 0.01505 < p4d 0.0175 < p4de 0.0195 < p5 0.0225).

    A test asserts each family's rate against every one of its sizes. That is not ceremony: it is the only check on a column of hand-computed decimals, and a mistyped digit in one row would leave every other assertion in the file passing.

    5. AC 5 — the RunInstances asymmetry is recorded, not fixed

    Recorded, with the reason, in docs/services.md. The evidence that decided it: six instance types are launched by fixtures in this repository and none of them is in the catalog — m7i.large (×5), t2.micro (×2), c7i.xlarge (×2), t4g.nano, m7i.xlarge, c6a.xlarge. Validating at launch would refuse types AWS plainly offers, which is the same failure the completeness invariant exists to prevent, moved onto the operation that creates state. Widening the catalog is the direction that closes the gap honestly; tightening the launch path is not.

    The consequence a caller needs is stated too, because it is the part that is not obvious from the divergence itself: an instance's reported instanceType is recorded intent, not an assertion that substrate models the type. A test asserts the divergence rather than the fix, so closing it later is a deliberate edit here and not a silent behaviour change.

    One thing found while doing this, filed separately

    describeInstanceTypes hardcodes CurrentGeneration: true for every catalog entry (ec2_plugin.go:5850). p3 is the one family here that AWS publishes on the previous-generation page, so its rows now carry a value AWS would report as false. It was already wrong for p3.2xlarge before this change, so the PR does not introduce it, and it is not fixed here because fixing it honestly also means implementing the current-generation filter — which is currently one of the fifty-two accepted-and-inert names, so an accurate currentGeneration beside an inert filter would let a caller filter on current-generation=true and get p3 back with false in its own body. That is a separate unit of work with its own docs and test-name consequences. Recorded in docs/services.md and filed as #1028.

    The counts for inf1, inf2, trn1 and trn2 reaching no response member at all is filed as #1029, carrying the two reference quotes above so the member question does not need re-researching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ec2status: needs-designtype: feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions