Skip to content

feat(launch): --no-public-ip, private-only launches with a subnet endpoint pre-flight (#1433) - #1438

Merged
scttfrdmn merged 5 commits into
mainfrom
feat/1433-no-public-ip
Oct 30, 2026
Merged

scttfrdmn merged 5 commits into
mainfrom
feat/1433-no-public-ip

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1433

Adds spawn launch --no-public-ip, opt-in and off by default. Without it nothing changes.

What it does

  • No public address of any kind. No AllocateAddress or AssociateAddress, and so no Elastic IP to release. No interface asks for a public IP: a single interface sends AssociatePublicIpAddress=false explicitly, because a default subnet would otherwise assign one. A multi-card layout sends no AssociatePublicIpAddress at all, since EC2 accepts none with more than one interface.
  • Elastic IP quota. The quota pre-flight (Multi-interface EFA launch fails late at AllocateAddress when the region's Elastic IP limit is reached; preflight could catch it #1233) is skipped, so the quota no longer limits a fleet that never uses the addresses.
  • Subnet. It needs --subnet-id, or --az; with --az spawn picks a subnet and pins it. A job array or MPI cohort then launches every member in the subnet that was checked, with no AZ fallback into subnets nobody checked.
  • Pre-flight, before anything is created, using read-only DescribeSubnets, DescribeRouteTables and DescribeVpcEndpoints, cached per subnet. It passes if the subnet's route table has a NAT gateway route. Otherwise it needs all of:
    • an S3 gateway endpoint associated with the subnet's route table;
    • interface endpoints with private DNS enabled for ec2, ssm, ssmmessages and ec2messages.
  • Conditional needs. dynamodb for a spawn burst member, fsx with --fsx-create. These need a NAT route: webhooks, Slack notifications, the Windows bootstrap's AWS CLI download, and the MPI bootstrap's EFA installer.
  • Endpoint edge cases. An interface endpoint with private DNS disabled does not count, and neither does one that is not available. One with no subnet in the instance's AZ counts, with a warning. A gateway endpoint on another route table does not count.
  • Refusal and override. The launch is refused with the list of what is missing. --allow-missing-endpoints launches anyway and still prints the list.
  • Every path goes through Client.Launch's own check. That covers single launches, job arrays, MPI, spawn array retry (the persisted base config), foreground sweeps and spawn sweep resume (each member checked, and the sweep resume still drops every CLI flag other than IAM and lifetime (--pre-stop, --tag/--team, network, storage) #1400 member record carries the field), and launcher.Provision, which refuses a launch with no subnet or AZ before any AWS call.
  • Dry-run: Public IP: none (private only), with no Elastic IP line.
  • spawn connect prints a note that it uses SSM Session Manager when the instance has no public IP, and that --ssh needs one.

The endpoint list and how it is derived

aws.PrivateServices() (pkg/aws/private_network.go) is held to spored's code by TestPrivateServicesCoverEverySporedService (internal/iamcoverage). That test reuses the RTA/VTA call-graph inventory of every spored principal: the daemon plus pool-worker, pipeline-stage, provenance and run-queue. Every IAM service prefix reached must be served by an entry, and every entry's prefix must still be reached. Today the inventory reaches ec2, s3, dynamodb (burst peer registry), fsx (async FSx), sqs (pool worker), xray (refused at launch, #1335) and lambda (InvokeFunctionUrl for DNS, which no VPC endpoint serves). ssm, ssmmessages and ec2messages are the SSM agent's services, not spored's. spored makes no STS call: the plan expected one, and the call graph has none.

Refused combinations

  • --dns, --dns-domain, --dns-api-endpoint and --dns-function-arn: spored registers the public IP, and there is none. The record --name implies is skipped with a notice instead.
  • --wait-for-ssh.
  • --allow-missing-endpoints without --no-public-ip.
  • Neither --subnet-id nor --az.
  • A detached sweep, which is refused rather than carried. The subnet check needs your credentials at launch, and the orchestrator launches members later without it. Use --no-detach. Follow-up: sweep: carry --no-public-ip on a detached sweep (subnet check at --detach, LaunchSettings field) #1437.
  • --batch-queue/--queue-template and the wizard: neither reads the launch flags, so the flag would have been dropped silently.
  • spawn task run has no field for it; a gate fails if TaskSpec gains one.

Deviation from the brief

An S3 interface endpoint does not satisfy s3. The bootstrap fetches spored from https://spawn-binaries-<region>.s3.amazonaws.com, a global-style name that S3 interface-endpoint private DNS does not serve, so counting it would pass a VPC where spored never installs. Follow-up #1436 switches the bootstrap to the regional name.

IAM

  • Caller. The two new caller actions are ec2:DescribeRouteTables and ec2:DescribeVpcEndpoints (read-only). The regenerated docs/reference/cli-iam-actions.md lists them under every command that reaches Client.Launch. That over-approximates: only --no-public-ip launches call them.
  • Nested-spawn role. It grants both, because a child launch can use the flag. Its name is a hash of the grant document, so the name changes. The old role is deleted by the reaper's instance-role sweep once it has been unused for 24h.

Owner test recipe: c8gn.48xlarge, us-east-1 default VPC

# 1. Dry-run: expect "✓ --no-public-ip: s3: gateway endpoint vpce-…" lines for s3/ec2/ssm/ssmmessages/ec2messages,
#    "Public IP:    none (private only)", two EFA interfaces, and no Elastic IP line.
spawn launch --instance-type c8gn.48xlarge --region us-east-1 --az us-east-1a --efa --no-public-ip --ttl 1h --name npip-test --dry-run

# 2. Launch.
spawn launch --instance-type c8gn.48xlarge --region us-east-1 --az us-east-1a --efa --no-public-ip --ttl 1h --name npip-test

# 3. No Elastic IP and no public IP.
aws ec2 describe-addresses --region us-east-1 --filters Name=tag:spawn:instance-id,Values=<instance-id>   # expect []
aws ec2 describe-instances --region us-east-1 --instance-ids <instance-id> --query 'Reservations[].Instances[].PublicIpAddress'   # expect [] / null

# 4. spored healthy (the launch already verifies it; re-check the heartbeat and status).
spawn status npip-test

# 5. Connect over SSM; expect the "no public IP (private only), so connect uses SSM" note.
spawn connect npip-test
spawn connect npip-test -- 'fi_info -p efa | head -3'

# 6. Terminate and leak-check.
spawn terminate npip-test
aws ec2 describe-instances --region us-east-1 --filters Name=tag:Name,Values=npip-test Name=instance-state-name,Values=pending,running,stopping,stopped
aws ec2 describe-addresses --region us-east-1 --filters Name=tag:spawn:managed,Values=true

To also see a refusal, run the same dry-run in us-west-2: the default VPC there has no endpoints, so expect the refusal listing s3, ec2, ssm, ssmmessages and ec2messages.

Checks

make check, make lint (0 issues), semgrep scan --config=auto --error (exit 0), make api-snapshot (additions only), make cli-iam-actions, and make gen-docs + check-docs. Every new gate was watched failing against a revert that compiles (list in the agent report).

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.81789% with 35 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/aws/private_network.go 86.54% 30 Missing ⚠️
cmd/launch_sweep.go 0.00% 2 Missing ⚠️
cmd/resume.go 0.00% 2 Missing ⚠️
cmd/launch_no_public_ip.go 97.56% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 51dbb96 into main Oct 30, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the feat/1433-no-public-ip branch October 30, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-card --efa always takes an Elastic IP although spawn is SSM-first: allow private-only launches (EIP quota caps EFA fleet size)

1 participant