Skip to content

fix(launch): refuse a launch over AWS's 50-tag limit before any AWS call (#1336) - #1358

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/1336-tag-limit
Oct 27, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/1336-tag-limit

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1336

buildTags now refuses a tag set over AWS's 50-tag limit with a *aws.TagLimitError instead of handing it to RunInstances, and every launcher path that creates something before Client.Launch runs a pre-flight first, so the refusal comes before any AWS call.

What the error says

refusing to launch: the instance would carry 55 tags and AWS allows 50 per resource, so RunInstances would reject it (#1336). Drop at least 5 of: the optional spored settings --idle-cpu-threshold (spawn:idle-cpu), --metrics (spawn:metrics-enabled), --metrics-port (spawn:metrics-port), --metrics-bind (spawn:metrics-bind), --metrics-path (spawn:metrics-path), --tracing (spawn:tracing-enabled, spawn:tracing-exporter), --tracing-sampling (spawn:tracing-sampling). The remaining spawn: tags are what spored enforces the TTL, idle and cost limits from. Counted: 1 tag(s) spawn writes after launch (spawn:spot-price-per-hour)

When --tag values are present it names how many (the 80 custom --tag value(s)).

The count includes tags spawn adds after RunInstances

That is why the issue's 54 shows up as 55. The documented monitoring setup on a maximal launch is 49 + 1 = 50 and still fits. The spawn:param:* budget uses the same limit, so a Spot sweep member keeps one fewer parameter tag when they are dropped to fit. Parameters are still dropped, never refused.

Pre-flights, by path

path before now
spawn launch (single, --count, wizard, pipe, --dry-run, --estimate-only) refused by RunInstances after key pair, IAM, SG, Strata upload, durable FSx preflightLaunchTags in runLaunch, before the Strata upload. Stand-ins for target OS + local user, the Strata URI, a durable/--fsx-id/--fsx-recall FSx's ID and mount name, and a job array's tags
parameter sweep, foreground and detached after applyCLIIAMToSweep (IAM), key pair, SetupSporedIAMRole, or (detached) in seedDetachedBootstrap, after the IAM step preflightSweepTags right after the sweep ID is minted, before --estimate-only, IAM, keys and the upload
launcher.Provision (task run, service, SDK callers) after the AMI lookup and SetupSporedIAMRole ValidateTagCount after the user-data check, before the AMI lookup
sweep orchestrator Lambda none memberTags refuses a member with more than 50 tags (backstop; the CLI refuses first)
Client.Launch (every caller: burst, app, image, pool, batch queue, taskcohort, mpicohort) RunInstances buildTags refuses before RunInstances

Not changed, and why: spawn schedule create (rows have no tag inputs; unknown row keys become droppable spawn:param:*; base config is empty), spawn task run (TaskSpec has no tag field; fixed ~20 tags; still covered by Provision), batch queue, burst, app, image, pool, service (fixed small tag sets, no --tag or spored settings reach them), pipeline orchestrator (fixed ~16 tags). Spot replacements (pkg/spotrequest/replacement.go) and the TTL reaper's spotrequests.go write no tags. The reaper's EIP/net-resource discovery stamp adds one tag to resources that carry about 8. Launch's ENI specs carry no tags.

Volumes

RunInstances puts the same tag set on every volume, so the instance check covers the volume TagSpecification. propagateSnapshotTagsToVolumes then added spawn:from-snapshot plus the snapshot's custom tags with CreateTags, which fails the whole call past 50. It now adds only what fits beside the launch's tags (fitVolumeTags: provenance first, keys already present take no slot) and names the rest in a warning.

Gates (each watched failing against a revert that compiles)

  • Maximal config + every No launch path can set spored's metrics/tracing/idle-cpu tags (launch flags or --tag allow-list) #1308 setting is refused with the count: TestMaximalSporedSettingsLaunchIsRefused (pkg/aws). With the checkTagLimit call replaced by error(nil): built 54 tags with err=<nil>; want a *TagLimitError.
  • TestFunctionalTagsAreNeverDropped expects refusal: with 80 --tags it now wants a *TagLimitError naming the 80; with the same revert: built 126 tags with err=<nil>. Its sweep-parameter half still asserts every functional tag survives.
  • Documented monitoring set still fits: TestMonitoringSettingsFitOnAMaximalLaunch now also runs ValidateTagCount. Revert <= to < in checkTagLimit: refused at 50. Revert the Spot reserve to two slots: refused at 51.
  • Refused launch makes zero AWS calls:
    • TestLaunchOverTheTagLimitMakesNoAWSCall (cmd): runLaunch against an httptest AWS endpoint that records every request; only the audit GetCallerIdentity is allowed. With the pre-flight call disabled it went on to SSM GetParameter (AMI detection) and failed there.
    • TestSweepOverTheTagLimitMakesNoAWSCall (cmd): launchParameterSweep, zero requests. With the pre-flight disabled it went on to load the compute AWS config for the detached path.
    • TestProvisionRefusesTooManyTagsBeforeAnyAWSCall (pkg/launcher): counting transport, zero requests. With the call disabled: SSM GetParameter.
  • Also: TestValidateTagCountCountsWhatLaunchResolves (pre-flight counts the price/account-name Launch resolves later), TestTagLimitLeavesRoomForAnEphemeralFSx, TestPreflightLaunchTagsCountsWhatTheLaunchAddsLater (strata, --count, durable FSx counted exactly; each placeholder reverted fails it), TestFitVolumeTagsStaysWithinTheLimit, TestMemberOverTheTagLimitIsRefused (Lambda). All watched failing against compiling reverts.

Follow-ups filed

No AWS calls were made. No new IAM permission is needed.

@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.33858% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/aws/client.go 0.00% 7 Missing ⚠️
cmd/launch_tag_preflight.go 91.42% 3 Missing ⚠️
pkg/aws/tag_limit.go 98.57% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…all (#1336)

buildTags returns a *TagLimitError naming the count, the limit, the --tag
count and each spored setting that added a tag, counting the tags spawn
writes after RunInstances (Spot price, ephemeral FSx). Pre-flights in
runLaunch, launchParameterSweep and launcher.Provision refuse before the
first AWS call. Snapshot tags copied onto volumes are limited to what fits;
the sweep orchestrator refuses a member over 50 tags.
@scttfrdmn
scttfrdmn merged commit 5246f02 into main Oct 27, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1336-tag-limit branch October 27, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

buildTags does not refuse a launch over AWS's 50-tag limit; maximal launch + all #1308 spored settings = 54 tags

1 participant