Skip to content

Pricing: GetProducts has no AmazonEC2 offer data (corpus is AmazonS3 only) #894

Closed

Description

@scttfrdmn

pricing:GetProducts for ServiceCode=AmazonEC2 returns:

NotFoundException: no offer data for ServiceCode AmazonEC2; substrate's corpus covers AmazonS3

Consumer / why: sonde pulls on-demand EC2 rates from the Price List API (never hardcoded) to compute per-probe cost. It calls GetProducts(ServiceCode=AmazonEC2) filtered by regionCode, instanceType, operatingSystem=Linux, tenancy=Shared, preInstalledSw=NA, capacitystatus=Used, marketoption=OnDemand, and parses terms.OnDemand.*.priceDimensions.*.pricePerUnit.USD. Even a small seeded EC2 on-demand corpus (a few g-series types × a couple regions) would let the cost path be tested offline.

Activity

  1. scttfrdmn commented on Sep 15, 2026

    @scttfrdmn
    OwnerAuthor

    Confirmed, and the good news is that this is a data gap, not a code gap — every piece of machinery the request needs is already built and already exercised against S3.

    Where the refusal comes from

    pricingEntriesFor (emulator/pricing_plugin.go:533) gates on the service-attribute registry, not on the corpus:

    if _, ok := pricingServiceAttributes[serviceCode]; !ok {
        return nil, pricingError(pricingErrNotFound,
            "no offer data for ServiceCode "+serviceCode+
                "; substrate's corpus covers "+strings.Join(pricingServiceCodes(), ", "))
    }
    

    and pricingServiceAttributes (pricing_offer_fixture.go:331) has exactly one key, pricingServiceCodeS3. Its doc comment records why the loud error is deliberate: "A caller asking for a real service substrate does not carry gets a loud error rather than an empty PriceList that reads as 'AWS has no such price'. A false alarm is visible; a false empty is not." So the current behaviour is correct — it just has nothing to say about EC2.

    Worth noting one thing that looks like a contradiction and is not: awsServiceCodeMap (pricing.go:74) does carry "AmazonEC2": "ec2". That map belongs to the cost-estimation provider, a different subsystem from the Price List Query API's offer corpus. Two pricing subsystems disagree about which services substrate knows a price for, and only one of them is what GetProducts reads.

    What is already done

    • All five filter types, not just TERM_MATCH: pricing_plugin.go:113-117 defines TERM_MATCH, EQUALS, CONTAINS, ANY_OF and NONE_OF, matching the Filter reference's published set verbatim, with ANY_OF/NONE_OF taking a comma-separated Value (:605-607).
    • Conjunctive filtering with the right absent-field semantics (matchesAll, :592): a filter naming a field the product does not carry never matches, "including NONE_OF, since AWS filters over products that have the field rather than over those that lack it." All seven of the filters in this issue would therefore be applied correctly the moment the SKUs exist.
    • DescribeServices and GetAttributeValues are dispatched (:171, :173) and both read the same registry, so an EC2 entry makes the whole discovery path work, not just GetProducts.
    • MaxResults is refused rather than clamped outside 1–100 (pricingLimit, :516), which matches the reference's "Minimum value of 1. Maximum value of 100."

    What has to be added, and the one constraint that makes it real work

    Two things: an AmazonEC2 entry in pricingServiceAttributes, and EC2 entries in pricingCorpus (pricing_offer_fixture.go:122).

    The constraint is the file's own standing rule, stated in its preamble and non-negotiable if the fixture is to be worth anything:

    Every SKU, attribute value, rate code, offer-term code and price string below is copied from the live AWS offer file … Nothing here is invented, because the point of the corpus is to reproduce the shapes that surprise a caller — and a tidied-up fixture would let a consumer's code pass its tests and then misbehave against the real API.

    So the SKUs, rate codes and pricePerUnit strings have to be lifted from https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/<region>/index.json at authoring time and the version/publication date recorded alongside S3's (pricingOfferVersion, :38). That file is orders of magnitude larger than S3's 381 products, so the work is selecting a defensible slice rather than transcribing one — this issue's "a few g-series types × a couple regions" is the right instinct, and the corpus's existing principle ("each entry exists to exhibit a specific shape a caller must handle") says which slice: whichever SKUs make the EC2-specific traps visible.

    Two candidate traps to look for while sampling, both of which would bite the parse path described here:

    • The seven-filter query in this issue (regionCode, instanceType, operatingSystem, tenancy, preInstalledSw, capacitystatus, marketoption) is the documented recipe for one on-demand rate, and the reason all seven are needed is that dropping any one returns several SKUs. A corpus that carries only one SKU per instance type cannot demonstrate that, so it would let an under-filtered query pass here and return multiple rows against the real API. At least one instance type should therefore appear with more than one capacitystatus/preInstalledSw combination.
    • terms.OnDemand.*.priceDimensions.*.pricePerUnit.USD is a two-level wildcard walk, and S3's corpus already shows why the second level matters: TimedStorage-ByteHrs carries three priceDimensions and "a parser that takes the first dimension silently reports the 50 TB tier rate as if it were the only one." EC2 on-demand compute is single-dimension, so a caller that works against an EC2-only corpus may have code that breaks on any tiered SKU — worth stating in docs/services.md rather than solving.

    Also note pricingServiceAttributes' invariant: "Every name is one that actually appears in the offer corpus, so a caller can move from DescribeServices to GetAttributeValues to a GetProducts filter without hitting an attribute that yields nothing." The EC2 attribute list must therefore be exactly the set the chosen SKUs carry — not EC2's full published attribute set — or GetAttributeValues starts reporting names that filter to nothing.

    Design question worth settling first

    There is no seed endpoint for offer data. The eleven /v1/pricing/* control routes (server.go:444-454) cover refresh, lookup, discounts, credits and query failures — but nothing injects a PriceList document. Given the copied-verbatim rule above, a POST /v1/pricing/offers seed is arguably the better primary answer for this class of request: it lets a consumer supply the exact slice of the real offer file its own tests need, at whatever size, without substrate having to guess which instance types and regions matter or re-transcribe the file as prices change. A small bundled EC2 slice and a seed endpoint are complementary — the slice makes it work out of the box, the seed makes it work for types substrate did not pick.

    Recommend deciding that before transcribing anything, since it changes how much of the offer file needs to be bundled.

    Blocker shared with #891 and #892

    g6 is not in substrate's instance-type catalog (ten families: c5, c5a, g4dn, inf1, m5, m5a, p3, r5, t3, t3a, ec2_instancetypes.go:76-167). The pricing corpus is independent of that catalog, so an EC2 offer slice could price a type DescribeInstanceTypes refuses — which would be its own inconsistency, and an argument for sampling the offer file for types the catalog carries, or for widening the catalog first. Filed as #896.

    Sizing

    M — mostly research and transcription rather than code, plus the seed-endpoint decision above. Moved to v0.118.0 with #891 and #892.

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

    @scttfrdmn
    OwnerAuthor

    Implemented in #1034. The corpus is 32 EC2 SKUs extracted from the three live offer files, and this
    consumer's exact query — regionCode, instanceType, operatingSystem=Linux, tenancy=Shared,
    preInstalledSw=NA, capacitystatus=Used, marketoption=OnDemand, then
    terms.OnDemand.*.priceDimensions.*.pricePerUnit.USD — returns exactly one rate for
    g4dn.xlarge, g5.2xlarge, g6.xlarge, inf2.xlarge, p4d.24xlarge, p5.48xlarge,
    trn1.32xlarge, m5.xlarge and t3.micro in us-east-1 and us-west-2, and for six of those nine
    in eu-west-1.

    Four things above are resolved differently than proposed, and three traps turned up in the data that
    were not predicted. All of them are consumer-visible, so they are on the record here rather than only
    in the diff.

    The seed endpoint is not the primary answer — it is a separate issue

    My earlier comment recommended settling POST /v1/pricing/offers before transcribing anything,
    on the grounds that a seed lets a consumer supply whatever slice it needs. That recommendation is
    withdrawn as a blocker: it conflates two different questions, and only one of them is this issue.

    Bundled data answers "what does AWS charge for a g6". A seed answers "what does my code do when the
    rate is X"
    . This issue reported the first — GetProducts(ServiceCode=AmazonEC2) answering
    NotFoundException — and a seed does not fix it, because a consumer that has to supply the rate it is
    testing against is back to the hand-maintained table the Price List emulation exists to replace. The
    seed is genuinely worth having for the ~107,000 us-east-1 compute products and ~200 service codes
    outside any defensible bundled slice, so it is filed as #1033 with the four open questions it raises
    (does a seeded SKU register in DescribeServices, may it replace a bundled SKU, what revision does it
    report, and which malformed shapes must be refused). It is not a prerequisite for this one.

    No rate is derived from another rate

    The tempting shortcut — bundle one Region and scale the others, or bundle one instance size and scale
    by vCPU — is not taken, and the data says why:

    • eu-west-1 is a per-family premium over us-east-1, not one Region multiplier: p4d ≈1.080×,
      inf2 exactly 1.250×, m5 ≈1.115×, t3 ≈1.096×. A single multiplier would be wrong by up to 15%.
    • us-west-2 is byte-identical to us-east-1 on every rate in the slice except p4d.24xlarge,
      which is 21.9576420000 in one file and 21.9576400000 in the other. A consumer that assumes two
      Regions agreeing on nine rates agree on the tenth is wrong at the seventh decimal place.
    • eu-west-1 publishes no g6, p5 or trn1 compute product at all. A derived rate would invent
      one, and a consumer would price a Region it cannot launch in.

    So every SKU, rate code, description, attribute value and ten-decimal price string is the offer file's
    own. The extraction streams the three files (480 MB each) rather than transcribing, and each rate
    independently reproduces the measured notes. The one structural liberty is that the physical attributes
    of an instance type — vcpu, memory, clockSpeed and the rest — are held once per type rather than
    repeated per Region, and that factoring was verified by measurement: only location, regionCode
    and usagetype vary by Region for a given type.

    Three traps that were not predicted, all of which hit this consumer's parse path

    1. The seven-filter recipe is not sufficient. My earlier comment said all seven filters are needed
      because dropping one returns several SKUs. That understates it: with all seven applied, a Windows
      m5.xlarge in us-east-1 still returns three SKUs. They share one usagetype and differ only
      in licenseModel and operation — $0.376 with a license, $0.192 without one, $0.192 BYOL. So
      licenseModel is an eighth discriminator, and a caller that takes PriceList[0] picks one of the
      three arbitrarily. The Linux path this consumer uses does return one rate; the corpus carries all
      three Windows rows so that the assumption is falsifiable rather than latent.
    2. usagetype is not 1:1 with a SKU. The S3 corpus's own preamble calls it "the attribute that is
      reliably present and 1:1"
      . That is true of the S3 offer file and false of the Price List API: four
      SKUs in this slice share BoxUsage:m5.xlarge. The claim is now scoped to S3 in both the fixture
      preamble and docs/services.md, because a caller keying on usagetype is relying on an S3 accident.
    3. marketoption alone separates a $55.04 p5.48xlarge from a $0.00 one. The $0.00 row is the
      Capacity Block product, and it satisfies the other six filters. A query that omits marketoption
      can report a free p5 — which is the worst failure shape for a cost path, since it looks like a
      successful lookup.

    Also reproduced, each measured rather than assumed: capacitystatus and tenancy change the
    usagetype token (UnusedBox:, DedicatedUsage:) rather than only the price, so a caller matching
    the prefix BoxUsage: silently misses them; the usagetype Region prefix is not derivable from the
    Region code (us-east-1 none, us-west-2 USW2-, eu-west-1 the legacy EU-, not EUW1-); and
    Compute Instance excludes bare metal, which is a separate productFamily.

    The free-tier pseudo-product, and a per-service offer revision

    One SKU in the slice is not an instance rate at all — the free-tier product present in every Region
    file. It is carried because it falsifies five invariants a parser written against the nominal rows
    would assume: no instanceType on a Compute Instance product, endRange "750" rather than
    "Inf", an offerTermCode (A429C66SYZ) that is not the global on-demand code, a non-empty
    termAttributes, and an appliesTo listing 170 SKUs where every other on-demand dimension's is empty.
    Its regionCode is the empty string, so a Region-scoped query never selects it — which is why a
    consumer filtering by Region never sees its $0.00 rate, and why the corpus can carry it safely.

    Two of those needed a shape change, so they are worth naming: pricingCorpusEntry gained
    offerTermCode and termAttributes, both defaulting to what AWS emits everywhere else. And because
    EC2 and S3 publish on their own schedules, a PriceList document now reports its own service's
    version and publicationDate rather than one global pair — as the real API's do.

    The catalog inconsistency is not resolved by narrowing the corpus

    My earlier comment suggested sampling the offer file for types substrate's instance-type catalog
    already carries, or widening the catalog first. Neither is done, deliberately: the corpus prices g5,
    g6, inf2, p4d, p5 and trn1, none of which DescribeInstanceTypes reports.

    The reason is that the two data sets answer different questions and are not generated from a shared
    source. A rate in the Price List corpus is not a claim that the type can be launched — the real Price
    List API prices types an account may have no access to, and a consumer's cost path reads rates without
    ever calling DescribeInstanceTypes. Narrowing the corpus to the catalog's ten families would have
    dropped every g-series type this issue actually asked for. The inconsistency is real and it is #896's
    to fix by widening the catalog; docs/services.md states the boundary explicitly so it is a documented
    divergence rather than a surprise.

    What the corpus is not

    It is not exhaustive — us-east-1 alone publishes 107,022 compute-instance products. An instance type
    absent from the corpus returns an empty PriceList, which reads the same as a Region that genuinely
    does not publish it. Where the absence is the observation (the three eu-west-1 types), it is
    because the real file omits them too. trn2 appears at no rate in any Region for the same reason: a
    real query returns nothing for it.

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: costsstatus: needs-designtype: feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions