Skip to content

launcher.Provision: create ephemeral FSx AFTER a successful RunInstances (eliminate create/teardown churn on capacity-failed launches) #213

Closed

Description

@scttfrdmn

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:

Acceptance

  • A capacity-failed --fsx-create launch issues zero CreateFileSystem calls (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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions