Skip to content

Legacy detached members with no iam_role need spored-instance-profile, which a v0.146.0-only account may not have #1369

Closed

Description

@scttfrdmn

Found while fixing #1368. It is a code trace and has not been run on AWS.

What happens. For legacy params (v0.146.0-or-older CLI, or a schedule one created) with no iam_role, the orchestrator now launches the member with spored-instance-profile (buildRunInstancesInput's fallback). The v0.146.0 orchestrator used spawnd-role (git show v0.146.0:lambda/sweep-orchestrator/main.go, lines 749 and 1567).

Why not keep spawnd-role. Its policy (scripts/setup-spawnd-iam-role.sh) grants ec2:DescribeInstances, DescribeTags, TerminateInstances, StopInstances and CancelSpotInstanceRequests, and no ec2:CreateTags. spored therefore cannot write spawn:last-heartbeat, and #1313 terminates the member 5 minutes after launch.

The gap. On the v0.146.0 detached path the CLI never calls SetupSporedIAMRole. launchSweepDetached and seedDetachedLaunchKeys only seed baseConfig.IamInstanceProfile, which is empty when no IAM flags are passed. So an account that has only ever run detached sweeps (the default for --param-file) and was onboarded with setup-spawnd-iam-role.sh may have spawnd-role but no spored-instance-profile. In such an account RunInstances fails each legacy member with an invalid-profile error. That is a failed row, not a leak, but the account still needs one more step: re-running the sweep with a current CLI ensures the profile (ensureDetachedInstanceProfile), and so does any foreground spawn launch.

Options.

  • Have the orchestrator recognise the invalid-profile error on a legacy member and name the remedy in the row's error message.
  • Grant the cross-account role enough IAM to ensure spored-instance-profile itself. That is a wider grant in member accounts.
  • Update setup-spawnd-iam-role.sh / spawnd-role to the spored policy (tag-conditioned CreateTags), and fall back to it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions