Repository navigation
Description
Background
spawn#210 (fixed in v0.60.0) closed the orphan hole: a failed --fsx-create launch no longer leaks the ephemeral FSx, via a compensating teardown (delete the FSx if RunInstances fails) + a reaper safety net. That made the autonomous flow safe.
This issue is the cleaner structural fix #210 deferred: reorder so the FSx is created only once we have compute. It removes the churn the teardown currently papers over.
The churn
launcher.Provision today (post-#210):
3.5 create ephemeral FSx (CreateFileSystem)
4. RunInstances
└─ on failure: delete the FSx we just created (teardown)
Under lagotto's per-AZ retry sweep (pkg/watcher/spawner.go walks m.CandidateAZs, one Provision call per AZ), a capacity-scarce watch does create → launch-fails → teardown for every AZ attempt, every poll. A 3-AZ poll = 3 create+describe+delete cycles against the FSx API + quota, repeated each interval. It's safe (no orphans) but wasteful, and it leans on the teardown as the normal path rather than an exception.
This also can't be fixed cleanly at the lagotto layer (see lagotto#45): an ephemeral FSx is single-AZ and must co-locate with the instance (#208), so it can't be pre-created once and reused across the AZ sweep; and lagotto can't know an AZ has capacity until RunInstances is attempted. The ordering belongs in Provision.
Proposal — RunInstances first, then FSx
Reorder Provision:
1-3 AMI / IAM / user-data (unchanged)
4. RunInstances
└─ on failure: return — NO FSx was created, nothing to clean up
4.5 create ephemeral FSx (async), tag the now-launched instance spawn:fsx-pending
└─ spored waits → DRA → mounts once AVAILABLE (unchanged #194 behavior)
Implications to work through:
- Tagging: the instance must be tagged
spawn:fsx-pending=<fsid>after both exist. Today the FSx id is stamped on the config before launch so the launch tags carry it; reordering means tagging the instance in a second step (post-RunInstancesCreateTags), or passing the id into a post-launch tag call. Needs care so spored still finds the pending FSx to mount. - Lustre SG ports / EnsureLustrePorts: currently done around FSx-create; keep it before the mount but it can move after launch.
- The CRITICAL: --fsx-create creates FSx BEFORE launch succeeds; capacity-failed launches orphan 1.2TiB filesystems → quota exhaustion + ~$14.6k/mo cost (compounds under lagotto retry) #210 teardown becomes a backstop, not the per-attempt norm — keep it for the (now rare) window where FSx-create succeeds but a later step fails. The reaper ephemeral-orphan net (CRITICAL: --fsx-create creates FSx BEFORE launch succeeds; capacity-failed launches orphan 1.2TiB filesystems → quota exhaustion + ~$14.6k/mo cost (compounds under lagotto retry) #210) stays as the outer backstop.
- CLI path (
cmd/launch.go) has the same ordering and should match. - Latency: no user-visible change — spored already mounts FSx asynchronously, so moving the create a few seconds later (after RunInstances returns) doesn't affect the caller.
Acceptance
- A capacity-failed
--fsx-createlaunch issues zeroCreateFileSystemcalls (verifiable: it never had to create-then-delete). - A successful launch behaves exactly as today (instance tagged
spawn:fsx-pending, spored mounts once AVAILABLE, reaped on terminate). - lagotto#45 verification: a multi-AZ capacity-fail poll creates zero filesystems.
Refs
#210 (orphan fix — this is the deferred structural follow-up, its suggested fix #1), #208 (FSx must co-locate with the instance AZ), #194 (async create + spored mount), lagotto#45 (consumer-side verification).
Activity
chore(release): v0.61.0
fix: Provision tears down instance on post-launch failure (#220)
fix: Provision tears down instance on post-launch failure (#220) (#230)
fix(aws): retry RunInstances on the IAM instance-profile propagation …
fix(aws): retry RunInstances on the IAM instance-profile propagation …