Repository navigation
Description
Problem
spawn uses EC2 instance tags as spored's configuration file. pkg/aws/tags.go can write 71 distinct spawn:* keys. spored reads its settings back from them at boot and on reload (pkg/provider/ec2.go config-from-tags, pkg/agent/agent.go refreshConfigFromTags). spored also writes up to about 13 status tags of its own at runtime: last-heartbeat, compute-seconds, spored-version, price-source, flush-status, logged-in-count, the dns-*, fsx-dra-* and ready-* families. All of them share AWS's 50-tags-per-resource limit, together with whatever --tags the user passes.
Measured on main (a throwaway test calling buildTags, since deleted):
| launch | tags at launch |
|---|---|
plain (--ttl 8h, name) |
14 |
+ --spot --idle-timeout 1h --on-complete terminate |
18 |
| maximal config + every #1308 setting | 54 (55 counting post-launch tags; #1336 / #1358) |
So a plain instance can reach roughly 27 tags with nothing unusual set. Every spored setting added so far has gone into another tag (#1308 most recently: metrics, tracing, idle-cpu). That is the trend #1336 (refuse over 50) and #1355 (no room for spored's runtime tags) are reacting to.
Tags are also a poor config store in other ways:
- 256-character values. A long
--command, for example, is just not tagged (len(config.JobArrayCommand) <= 256). - Visible account-wide. They can be read by every principal with
ec2:DescribeInstances/DescribeTagsin the account. That includes the webhook and notify URLs, which often carry a token. - A budget shared with the user's own tagging policy. That policy is often what org tag requirements are written against.
Proposal
Split the tags into two kinds. Only the second kind stays a tag.
-
Settings fixed at launch: spored needs them, and nothing changes them after the launch. These are on-complete, completion file and delay, pre-stop, notify, metrics, tracing, idle thresholds, ready port and path, web auth, FSx and EFS mount details, DCV and app settings, webhook URLs, and so on. They move to a per-launch config object: JSON, written by the launcher, and checked by hash or signature the way the task bootstrap is since User data: fetch the bootstrap from S3 behind a small verifying stub, removing the 16 KiB ceiling (follow-up to #1246) #1274/feat(task): stage the task wrapper and flush hook in S3 behind a sha256-verified fetch (#1274, PR B) #1293. spored fetches it once at boot and caches it on the instance, under
/etc/spawn/. One tag references it, e.g.spawn:config=<sha256>. -
Tags that stay: two groups.
- Changed during the instance's life:
ttl-deadline,cost-limit,compute-seconds,last-heartbeat, flush and ready status.spawn extend, spored and the reaper write these. - Filtered or read without access to the instance:
managed,root, ownership and account,sweep-id,job-array-id,price-per-hour. The reaper,list,costand the dashboard read these.
Audit every reader and writer to confirm the split. "Nothing changes it after launch" has to be shown, not assumed.
- Changed during the instance's life:
Expected effect: a maximal launch comes in well under 50, #1355 gets real reserve slots without making the documented monitoring setup refuse, #1358's refusal becomes a backstop users essentially never hit, and the URL-bearing settings stop being visible account-wide.
Open questions (decide before code)
- Where the object lives.
- The staging bucket
spawn-staging-<acct>-<region>already exists, but has a 1-day expiry. That's fine if spored caches it at boot, not fine ifreloadmust re-fetch. - User data could hold it, but that runs into the 16 KiB budget the User data: fetch the bootstrap from S3 behind a small verifying stub, removing the 16 KiB ceiling (follow-up to #1246) #1274 stub work just bought back.
- An SSM parameter needs a deleter (no-clutter principle).
- Whatever holds it must be removed with the instance or expire on its own.
- The staging bucket
- Transition. spored on existing instances and older AMIs reads tags. The launcher could write both for N releases, or new spored could read the object and fall back to tags. Old instances are never migrated, only aged out by TTL.
- Mutable fixed-settings. Does anything rely on editing one of the category-1 tags on a running instance and calling
spored reload(spored reload never reaches the running daemon: it reloads a throwaway agent in its own process #1278)? If so, that setting stays a tag, or gains anextend-style command.
Activity
scttfrdmn commentedon Oct 29, 2026
Decisions (owner, 2026-10-29):
Transition: pin spored to the launching CLI's version (new issue, done first). Then the object is a same-version contract: new CLIs write it and their spored reads it; old CLIs keep writing tags and get their old spored. No dual-write, and no fallback in spored.
Where: the staging bucket. Content-addressed
config-<sha256>.json, with one tagspawn:config=<sha>. spored caches it on the root volume at first boot. The reaper deletes it once its instance is terminated, which is the named deleter, plus a lifecycle backstop that must outlast the TTL. Persistent-Spot replacement re-fetches, which is why the backstop has to cover that case. A side effect: URL-bearing settings stop being visible account-wide.Stays a tag: the fields edited after launch:
spawn extend: ttl, ttl-deadline, cost-limit;spored config set: ttl, idle-timeout, on-complete, completion-file, completion-delay, hibernate-on-idle;listand the dashboard filter on.Everything else moves into the object.
spored's runtime tags have no room on an instance launched at the 50-tag limit (spawn:compute-seconds, spawn:last-heartbeat) #1355: set the reserve after this lands, computed as the count of tags spored can write, and enforced by the buildTags does not refuse a launch over AWS's 50-tag limit; maximal launch + all #1308 spored settings = 54 tags #1336 check.
feat(launchconfig): move launch-fixed spored settings from tags into …
feat(iam): spored roles read their launch config object; inventory th…
feat(sweep): a detached member's launch config object rides in its us…
feat(reaper): REAPER_LAUNCH_CONFIGS deletes launch config objects not…
test(launchconfig): discovery and no-tag-read gates; upgrade-spored r…
test(iam): spored roles read their launch config object and nothing e…
docs: launch config object in the monitoring guide, help text, CHANGE…
test: the reaper's one staging-bucket list is launch-config/ only; AP…
test(e2e): tier0 webhook launch asserts the launch config object, not…
Launch-fixed spored settings move to a per-launch config object; free…