Skip to content

spored-instance-role needs ec2:ImportKeyPair + full set of EC2 permissions for nested spawn usage #39

Closed

Description

@scttfrdmn

Summary

When an EC2 instance running spored-instance-role calls spawn launch (nested spawn, e.g. via nf-spawn), it hits multiple missing IAM permissions one by one. The role doesn't include the full set of permissions needed for spawn to operate.

Missing permissions discovered so far (in order)

  1. ec2:DescribeRegions — spawn lists regions on init
  2. sts:GetCallerIdentity — spawn checks identity (workaround: IMDS fallback in spawn fails with STS VPC endpoint: GetCallerIdentity times out when private DNS is enabled #33)
  3. ssm:GetParameter on /aws/service/ami-amazon-linux-latest/* — AMI auto-detection (spored-instance-role should include ssm:GetParameter for AMI auto-detection #38)
  4. ec2:ImportKeyPair — spawn uploads the SSH key before launching

Expected

The spored-instance-role IAM role that spawn creates should include all permissions required to run spawn launch from within an EC2 instance. This is necessary for nested spawn usage (e.g. nf-spawn dispatching compute tasks from a head node).

Suggested minimum policy additions

{
  "Effect": "Allow",
  "Action": [
    "ec2:DescribeRegions",
    "ec2:ImportKeyPair",
    "ec2:DescribeKeyPairs", 
    "ec2:DeleteKeyPair",
    "ec2:RunInstances",
    "ec2:DescribeInstances",
    "ec2:DescribeImages",
    "ec2:CreateSecurityGroup",
    "ec2:DescribeSecurityGroups",
    "ec2:AuthorizeSecurityGroupIngress",
    "ec2:CreateTags",
    "iam:CreateInstanceProfile",
    "iam:AddRoleToInstanceProfile",
    "iam:PassRole",
    "ssm:GetParameter"
  ],
  "Resource": "*"
}

Context

Activity

  1. added
    bug
    on Jun 3, 2026
  2. added
    area:infra
    on Jun 12, 2026
  3. added this to the Later milestone on Oct 19, 2026
  4. scttfrdmn commented on Oct 19, 2026

    @scttfrdmn
    ContributorAuthor

    Decision needed (milestone planning, 2026-10-18): how should nested spawn (spawn on a spore) get its permissions?

    Default if there's no objection: an opt-in elevated role, for example --nested-spawn. Never widen the default spored-instance-role, since RunInstances plus PassRole on every instance is privilege escalation.

  5. modified the milestones: Later, v0.146.0 on Oct 25, 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:infrabug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions