Repository navigation
feat(no-public-ip): count a working NAT instance as a way out (#1515) - #1516
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Nov 3, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1515 (first sub-task: preflight). The issue has more sub-tasks, so this PR does not close it.
What
--no-public-ip's subnet preflight now counts a 0.0.0.0/0 route to a working NAT instance as a way out. Before this change it counted only a NAT gateway.When the route names an instance (an ENI route attached to an instance carries
InstanceIdtoo), spawn reads that instance withec2:DescribeInstancesonly. It counts the instance as a way out only if all of these hold:running;igw-. The route table is resolved withsubnetRouteTablefrom the VPC tables already read. This interface can differ from the routed one, so a two-interface NAT passes: inside ENI in the private subnet, public IP on an outside ENI in a public subnet.If any check fails, the launch is still refused, and each Missing entry names every failed check. For example:
0.0.0.0/0 goes to instance i-x, which is not a working NAT instance: its source/destination check is on (network interface eni-y), .... Other cases:--allow-missing-endpointsstill lists the rest.On success, Met says
everything, through NAT instance i-x on route table rtb-y. A Warning says spawn cannot see the instance's IP forwarding or iptables config, so it trusts the route.The model:
PrivateNetworkgainsNATInstanceIDandNATInstanceProblem, an additive public-API change with the snapshot regenerated.CheckPrivateNetworkstays pure.IAM
privateNetworkAPIgains onlyDescribeInstances. There is no DescribeNetworkInterfaces call and no other new action.make cli-iam-actionsaddsec2:DescribeInstancesto exactly one command row:spawn schedule create. That command checks member subnets at creation, throughdetachedSubnetCheck. The doc's "Outside any command" section already requiresec2:DescribeInstancesfor every spawn invocation (startup and the root pre-run), so no user who can run spawn lacks it. No IAM work for users.PreflightNoPublicIP; onlypkg/aws/client.go(Launch) and the cmd paths do. So no Lambda role changes.Tests
TestNATInstanceIsAWayOutuses a typed fakeprivateNetworkAPI, with 19 cases:stopping; all failures together.Revert gate, on compiling reverts. Each failed the named cases, and restoring the code passed them:
CheckPrivateNetworkfailed the working-NAT cases;Run locally:
make check,go test ./...with AWS env stripped, andsemgrep scan --config=auto --error ., all exit 0. No AWS access was used.Docs
The
--no-public-iphelp text is updated anddocs-gen/launch.mdregenerated.docs/reference/cli-iam-actions.mdandapi/public-surface.txtare regenerated, and there is a CHANGELOG entry under [Unreleased] → Changed.