Repository navigation
Closed
Labels
area:costcost estimation, budgets, accountingarea:lifecycleTTL / idle / on-complete / hibernation / reaperarea:storageFSx / EFS / S3 stagingenhancementNew feature or request
Description
Why (and why first)
Any feature that auto-creates an FSx Lustre filesystem (lagotto#43 durable storage; spawn launch --fsx-create; a future spawn fsx create) has an orphan window where a ~$150–200/mo PERSISTENT_2 1.2 TB filesystem can be left running with nothing watching it:
- capacity never appears, so the FSx idles until something reclaims it;
- the owning instance dies mid-provision, or terminates but the teardown call fails;
- any bug/crash/partial failure between create and delete.
Given the project's existential cost-control stance and the lifecycle invariant (#72, "everything dies eventually"), no FSx auto-create of any shape should ship before the reaper can reclaim an orphaned FSx. This is the gate, not a follow-up — filing it as the foundation the lagotto#43 work (and spawn launch --fsx-create, which today has no reaper backstop either) depends on.
Current state (scoped against the code)
- The ttl-reaper is EC2-only (
lambda/ttl-reaper/main.go) — it has no FSx awareness. - FSx-create already tags
spawn:managed=true,spawn:fsx-created=<RFC3339>,spawn:fsx-s3-bucket,spawn:fsx-stack-name, etc. (pkg/aws/fsx.go:109). But there's nospawn:ttl-deadlineon FSx, so there's no per-filesystem deadline to key on yet. - The delete call lives inline in the
fsx deleteCLI command (cmd/fsx.go:331), not as a reusablepkg/awsmethod — the reaper can't importcmd/.
Proposed work
- Stamp a deadline at create. Add
spawn:ttl-deadline(and/or rely on a max-age fromspawn:fsx-created) when an FSx is auto-created, so the reaper has an explicit, launch-anchored deadline — mirroring how instances are evaluated (evaluate()in the reaper). - Extract a reusable delete. Move the
DeleteFileSystemlogic fromcmd/fsx.gointopkg/aws(e.g.DeleteFSxFilesystem) and call it from both the CLI and the reaper. - Reaper scans FSx per account×region (
fsx:DescribeFileSystems, filtered tospawn:managed=true), and reclaims those past their deadline / max-age — alongside the existing EC2 scan, honoringREAPER_DRY_RUNandREAPER_NOTIFY_URLthe same way. ⚠️ Don't delete un-flushed data. An FSx with an active S3-export DRA must finish exporting before deletion, or the reaper recreates the exact --pre-stop does not reliably flush before TTL-triggered terminate → data loss on ephemeral storage #184 data-loss it's meant to prevent. The reaper must either confirm the DRA is idle/caught-up, or use FSx's export-on-delete / final-export semantics — not a blindDeleteFileSystem. This is a real design point.- IAM: the reaper's role (and the cross-account
REAPER_ROLE_ARNSroles) needfsx:DescribeFileSystems+fsx:DeleteFileSystem(+ DRA describe) — deploy-side.
Acceptance
- A
spawn:managedFSx past its deadline/max-age is reclaimed by the reaper (dry-run logs it; enforce mode deletes it), with the export-flush safety in ci: add coverage ratchet floor (22%) #4. spawn launch --fsx-createfilesystems are covered too (they're orphan-prone today with no backstop).- Notified via
REAPER_NOTIFY_URLlike instance reaps.
Blocks: lagotto#43 (durable FSx for auto-launch) and a spawn fsx create command. Relates to #72, #184.
Metadata
Metadata
Assignees
Labels
area:costcost estimation, budgets, accountingarea:lifecycleTTL / idle / on-complete / hibernation / reaperarea:storageFSx / EFS / S3 stagingenhancementNew feature or request
Activity
scttfrdmn commentedon Jun 16, 2026
Refcount/lease model — and the exact mechanism it rests on
Traced how an FSx actually attaches to a spore today, because the reaper's safety depends on it:
Association is one-directional, instance-only:
spawn:fsx-id,spawn:fsx-mount-name,spawn:fsx-mount-point(buildTags,pkg/aws/client.go:653).pkg/userdata/storage.goGenerateStorageUserData) runs the actualmount -t lustre <dns>@tcp:/<mountname> <mountpoint>+ an/etc/fstabline.The FSx itself records nothing about who mounted it — a Lustre mount is just a client connection. So an FSx with no back-reference gets no reaper safety. That's the gap to close.
Refcount via the forward tag (no new write path). The reaper should compute an FSx's refcount by joining on the tag the launch already writes:
This is a pure read-side change in the reaper (
DescribeInstancesfiltered byspawn:fsx-id), needs zero changes to the mount path or spored, and self-heals leaked leases (a vanished instance simply drops out ofDescribeInstances, lowering the count). It also means even a hand-mounted--fsx-idfilesystem gets refcount protection for free. The eventual-consistency edges are covered by the grace window — a race can only delay a reap (cost), never reap a live FS (data loss), so no distributed lock is warranted.Supersedes the explicit
spawn:fsx-user-<id>-tags-on-the-FSx idea (more moving parts, leaks on unclean death, requires writing tags to a resource the instance doesn't own).Mechanism gap this also surfaces (for the Path-B work, not this issue)
The lustre mount runs once at first boot via user-data. For instance-owned FSx created asynchronously (the lagotto "launch instance + FSx together" path), the FS isn't AVAILABLE at boot, so a baked-in mount fails. That path needs FSx mounting moved out of first-boot user-data into a spored "wait-for-pending-FSx → mount" capability — tracked with the Path-B launch work, not here. This reaper issue stands on its own regardless.
feat(ttl-reaper): reclaim orphaned FSx Lustre filesystems (refcount-a…
feat(fsx): explicit fail-closed lifecycle contract for --fsx-create (#…
feat(spored): mount async-created FSx at runtime (#194 part 1) (#198)
chore(release): v0.56.0 (#200)
feat(launcher): ephemeral async FSx-create in Provision (#202) (#203)
fix(reaper): grant cross-account role fsx:DescribeFileSystems + Delet…
fix: ttl-reaper deletes DNS on reap (#247) + deploy-script build (#248)…