Skip to content

Instance tags are spored's config file: move launch-fixed settings to a per-launch config object, keep tags for mutable/filterable state #1359

Closed

Description

@scttfrdmn

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 / DescribeTags in 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.

  1. 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>.

  2. 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, cost and the dashboard read these.

    Audit every reader and writer to confirm the split. "Nothing changes it after launch" has to be shown, not assumed.

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)

Refs #1336, #1355, #1308, #1278, #1274, #1293

Activity

  1. added this to the v0.148.0 milestone on Oct 27, 2026
  2. added
    area:launch
    area:spored
    type:infra
    on Oct 27, 2026
  3. modified the milestones: v0.148.0, v0.149.0 on Oct 28, 2026
  4. scttfrdmn commented on Oct 29, 2026

    @scttfrdmn
    ContributorAuthor

    Decisions (owner, 2026-10-29):

    1. 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.

    2. Where: the staging bucket. Content-addressed config-<sha256>.json, with one tag spawn: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.

    3. 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;
      • spored's runtime status tags;
      • the tags the reaper, list and the dashboard filter on.

      Everything else moves into the object.

    4. 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.

  5. modified the milestones: v0.149.0, v0.150.0 on Oct 29, 2026
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:launcharea:sporedcomponent:spawntype:infra

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions