Skip to content

Validate real-AWS launch end-to-end (spored self-termination) #2

Closed

Description

@scttfrdmn

The EC2 path is proven against substrate but never against real AWS. Validate the full flow on a real account: credentials → RunInstances with spawn:* tags → the spored userdata bootstrap installs + runs → the instance self-terminates on a short TTL.

Cost safety (per spore.host policy): use a tight --ttl, terminate explicitly, and leak-check (no orphaned instances/volumes/EIPs) afterward.

Acceptance:

  • documented manual run: launch → observe spored → auto-terminate on TTL
  • confirm IAM role assumptions for spored's self-lifecycle calls
  • note any divergence from the Go tool's bootstrap

Activity

  1. added
    area: aws
    cost-safety
    on Jul 20, 2026
  2. scttfrdmn commented on Jul 21, 2026

    @scttfrdmn
    ContributorAuthor

    Pre-launch investigation (read-only, no spend)

    Before spending anything on a real launch, I audited the launch path against real AWS + the actual spored release infra. Launching as-is would strand a billing instance rather than validate self-termination — the bootstrap can't install a working spored. Four concrete gaps, all fixable in spawn-ts code:

    1. spored download URL 404s. src/aws/userdata.ts fetches github.com/spore-host/spawn/releases/latest/download/spored_linux_amd64 → 404 (verified). No such bare-binary asset exists; GitHub releases ship versioned tarballs (spored_0.89.0_linux_arm64.tar.gz). The Go bootstrap (pkg/launcher/bootstrap.go) actually installs from S3 regional buckets: https://spawn-binaries-<region>.s3.amazonaws.com/spored-linux-<arch> — verified anonymously downloadable (HTTP 200/206) at the legacy path. spawn-ts invented a URL that never existed.
    2. Hardcoded amd64. t4g.nano (and any Graviton) is arm64; the Go bootstrap does uname -m → amd64/arm64. spawn-ts must detect arch in-script.
    3. No IAM instance profile. RunInstances in src/aws/ec2.ts attaches none, so spored can't call DescribeTags/TerminateInstances — self-termination is impossible even if the binary installs. Needs an IamInstanceProfile on the launch (+ a way to supply/select the spored role).
    4. No AMI resolution. spec.ami must be a real AMI id; nothing resolves one per region/arch (SSM public parameter for AL2023).

    These were invisible because the EC2 path was only tested against substrate, which doesn't execute user-data.

    Plan: fix the bootstrap (real S3 URL + arch detection + checksum, mirroring Go) and the IAM/AMI plumbing FIRST (code-only, no spend), then do the approved real launch (t4g.nano, 10-min TTL, us-east-1, explicit terminate + leak-check). Filing the bootstrap-URL bug as its own issue.

  3. scttfrdmn commented on Jul 21, 2026

    @scttfrdmn
    ContributorAuthor

    Live validation run (documented)

    Fixes in #18. After the four bootstrap gaps were fixed (see prior comment + spawn-ts#17), ran a real launch within the approved cost envelope.

    Envelope: t4g.nano · us-east-1 · 10-min TTL · spored-instance-profile · one instance · explicit terminate + leak-check.

    Run:

    • EC2Provider (real AWS, aws:us-east-1) resolved a current arm64 AL2023 AMI (ami-00b18f89b5bdfb338, al2023-ami-2023.12.20260720.0-kernel-6.1-arm64) via DescribeImages — no hardcoded AMI.
    • Launched i-0ad2d762fe1d21f8e, attached spored-instance-profile, spawn:ttl-deadline tag set 10 min out.
    • Reached running with a public IP within ~90s.
    • Explicitly terminated; confirmed terminated and no orphaned volumes. Only other spawn:managed instance in the account (build-medium-cgui) is unrelated/pre-existing. Spend ≈ $0.0001.

    IAM confirmed (acceptance item 2): spored-instance-profile → spored-instance-role grants ec2:DescribeTags/DescribeInstances/CreateTags + ec2:TerminateInstances/StopInstances — exactly spored's self-lifecycle needs.

    Divergence from the Go bootstrap (acceptance item 3): spawn-ts installs from the same S3 buckets and does arch detection + SHA256 verify, but does not verify the publisher signature (the Go bootstrap's optional SPORED_SIG_VERIFY, which needs a compiled-in signing key spawn-ts doesn't have). Checksum-only, matching the Go default when no key is compiled in.

    Not yet done (follow-up): I terminated at ~90s rather than paying to idle a real instance for the full 10 min to watch spored fire the TTL unattended. The install path + IAM + tags are all validated; observing the daemon self-terminate end-to-end is a small, separately-scheduled paid run. Leaving #2 open until that's done, or happy to close it as "launch path validated" if you prefer.

  4. scttfrdmn commented on Jul 21, 2026

    @scttfrdmn
    ContributorAuthor

    Unattended TTL observation — the guarantee does NOT yet fire

    Ran the full observation this time (5-min TTL, polled without terminating). The instance did not self-terminate — still running 4+ min past its deadline until the backstop killed it. Filed as #19.

    The bootstrap fixes (#18) are validated: spored installs and executes (console shows the systemd symlink + binary running). But its systemd unit crash-loops (res=success/res=failed every ~5s), so the daemon never enforces the TTL. Also spotted an SELinux mislabel — the binary inherits cloud_init_tmp_t from the /tmp mktemp mv, allowed only because AL2023 is permissive.

    So #2 splits cleanly:

    Keeping #2 open, now blocked on #19. Both live instances today were terminated + leak-checked; total spend <2¢.

  5. scttfrdmn commented on Jul 21, 2026

    @scttfrdmn
    ContributorAuthor

    ✅ Self-termination validated end-to-end on real AWS

    Root cause was a one-line divergence on the instance side: the systemd unit ran spored run, but the daemon is the bare spored invocation — the unknown subcommand made spored exit non-zero and the unit crash-looped, so it never enforced the TTL. Fixed in #20 by matching the Go bootstrap's unit byte-for-byte.

    Re-ran the unattended observation (t4g.nano, 5-min TTL, us-east-1, spored-instance-profile):

    18:52:27 state=running       (+0.1m past deadline)
    18:52:57 state=shutting-down  ✅ spored SELF-TERMINATED on TTL
    

    Stayed running right to the deadline, then spored wound it down ~35s later with no action from me. Confirmed terminated, no orphaned instances/volumes.

    All acceptance items met:

    • ✅ launch → observe spored → auto-terminate on TTL (documented above)
    • ✅ IAM role confirmed (spored-instance-profile: DescribeTags/DescribeInstances/CreateTags + Terminate/StopInstances)
    • ✅ divergence from Go noted: checksum-only (no publisher-signature verify; Go's optional SPORE_DNS_SIGV4/signing key isn't compiled into spawn-ts), and the browser-side S3 download vs Go's launcher — instance-side unit is now identical.

    Closing. Total spend across all validation runs today: under 3¢.

  6. added a commit that references this issue on Jul 21, 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: awscost-safety

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions