Skip to content

EC2: RunInstances accepts MinCount/MaxCount that are present but invalid #431

Closed

Description

@scttfrdmn

The non-breaking half of a suggestion made in #412, split out as offered there.

What #412 asked, and what was declined

#412 asked for "a quick pass for other required parameters." AWS marks only MinCount
and MaxCount as required on RunInstances, but in every typed SDK those are
required members — int32 in Go, required kwargs in botocore's validation layer —
so a consumer bug there fails client-side and never reaches the wire. Requiring their
presence would validate an unreachable bug class while breaking hand-built
form-encoded requests, which a good number of substrate's own tests are. So presence
validation was declined.

What is actually reachable

A value that is present but invalid does reach the wire, because the query
protocol carries it as a string:

  • MinCount=0 / MaxCount=0 — AWS requires at least 1.
  • MinCount=abc — unparseable.
  • MinCount=3&MaxCount=1 — min above max; AWS documents this as an error.

Substrate currently accepts all of these. MinCount=0 in particular launches
something rather than erroring, which is a silently-wrong result rather than a missing
one.

Proposal

When present, validate; when absent, keep defaulting exactly as today. That's what
makes this non-breaking — no existing test or CFN path that omits them changes.

  • Unparseable or < 1 → InvalidParameterValue.
  • MinCount > MaxCount → the code AWS actually returns for that case, which needs
    checking against the API reference rather than assuming (InvalidParameterCombination
    is the plausible guess, but SQS: seedable eventual-consistency delay on GetQueueUrl after CreateQueue #413 was a reminder that plausible guesses about AWS
    error codes are wrong often enough to matter).

Also worth confirming against real AWS behavior: whether MaxCount above the account
limit produces a distinct error, and whether the partial-fulfillment case (MinCount
satisfiable, MaxCount not) is in scope here or belongs with the capacity/quota
modeling in #387.

Acceptance criteria

  • Present-but-unparseable and < 1 values for either parameter → 400 with the
    verified code and message.
  • MinCount > MaxCount → 400 with the code verified against the AWS reference.
  • Absence still defaults — a regression test pins that a request omitting both
    still launches, so nothing that relies on today's behavior breaks.
  • Error codes and messages verified against the RunInstances API reference, not
    assumed.

Activity

  1. added
    type: bug
    priority: low
    on Aug 1, 2026
  2. added this to the v0.83.0 milestone on Aug 1, 2026
  3. added a commit that references this issue on Aug 1, 2026
  4. scttfrdmn commented on Aug 1, 2026

    @scttfrdmn
    OwnerAuthor

    Shipped in v0.83.0 (go get github.com/scttfrdmn/[email protected]).

    The release notes and CHANGELOG.md record the reasoning behind each decision, including where substrate deliberately stops short of what was suggested here.

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: ec2priority: lowtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions