Repository navigation
feat(bootstrap)!: retire the AWS CLI regional mirror; preflight counts the AWS CLI download (#1515 phase 7) - #1529
Merged
Merged
Conversation
…s the AWS CLI download (#1515 phase 7) spawn does not mirror third-party artifacts. The opt-in egress proxy (v0.158.0) reaches awscli.amazonaws.com, so the #1494 mirror goes. - Bootstrap (signed, published body): spawn_need_aws takes no region and fetches only https://awscli.amazonaws.com/..., still sha256-checked against the pin and fail-closed. Body sha256 73d1876b...c049 -> baa047b3...4b861. The --bootstrap-egress proxy install before the body is now "origin via proxy". - Preflight: without a NAT route, the AMI is read (ec2:DescribeImages, already in every launch). Amazon-owned Amazon Linux ships the CLI and needs nothing; any other Linux image (or one spawn cannot read) adds "the Linux bootstrap's AWS CLI download (awscli.amazonaws.com)", met only through the proxy, else refused naming --bootstrap-egress proxy. - Release: the mirror publish/verify steps and scripts/mirror-awscli.sh are removed. scripts/verify-awscli-pin.sh keeps the release-time check that each pinned zip is validly signed by the AWS CLI team key and has the pinned sha256, uploading nothing. - AWSCLIPin drops MirrorKey; `spawn awscli-pin` prints 3 fields. The S3 objects under spawn/awscli/ and the release role's mirror IAM policy are removed separately by the owner. Refs #1515
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…lt AMIs by their base (#1515 phase 7) - --efa MPI user data (per launch, not the signed body) fetches the pinned EFA installer only from efa-installer.amazonaws.com, still sha256-checked and fail-closed. spawn-binaries-<region>/spawn/efa/ was never published (#1507 won't-do), so every --efa member's first fetch was a 403. EFASources/efaInstallerSources/efaInstallerMirrorPrefix are gone; pin, efa-pin workflow and release-time verification unchanged. - --no-public-ip preflight: an image `spawn create-ami` made (spawn:created-from + spawn:base-ami) counts as shipping the AWS CLI when its base AMI (in spawn:source-region when tagged, up to 3 spawn-built hops) is Amazon's Amazon Linux. Missing or unreadable base keeps the need. The need now names both remedies: a NAT route or --bootstrap-egress proxy. Refs #1515
Contributor
Author
Live test at
|
| Check | Result |
|---|---|
Ubuntu 24.04 t4g.small, --no-public-ip, no opt-in |
Refused before anything was created: internet: the Linux bootstrap's AWS CLI download, as image ami-09a93d801db0bafae is not Amazon's Amazon Linux and may have no aws CLI (stock Ubuntu has none); a NAT route or --bootstrap-egress proxy reaches it (awscli.amazonaws.com) |
AL2023 t4g.small, --no-public-ip, no opt-in (--dry-run) |
Passes: only the endpoint checks, no internet need |
Ubuntu 24.04 2-node --mpi --efa with --bootstrap-egress proxy on c6gn.16xlarge |
Completed: SPAWN_COMPLETE = completed/mpi/0, all 128 ranks proxyvars=0, fi_info = efa-direct. Preflight lists both needs (EFA and AWS CLI) as met through the proxy |
| AWS CLI from origin only | spawn: no aws CLI; installing AWS CLI 2.39.3, then aws-cli/2.39.3. Proxy log: 3 × CONNECT awscli.amazonaws.com:443 (2 members and the readiness probe) |
| EFA from origin only | Installing EFA installer 1.51.0..., then EFA installation complete., with no curl: (22) … 403 mirror attempt (every earlier run had one). Proxy log: 2 × CONNECT efa-installer.amazonaws.com:443, one per member |
| Proxy log overall | Only allowlisted hosts: the two above plus ports.ubuntu.com / us-east-1.ec2.ports.ubuntu.com apt. No refusals |
Teardown: I terminated all 3 instances and deleted the VPC and everything in it. Leak diff against a pre-run baseline: no new instances, SGs, Spot requests, EIPs or test VPCs.
This was referenced Nov 5, 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 (phase 7). Retires the #1494 AWS CLI regional mirror in code. The owner decided against mirroring third-party artifacts, and the opt-in egress proxy (phases 3–6, released in v0.158.0) already covers
awscli.amazonaws.com.Important
This changes the signed, published bootstrap body. Its sha256 goes from
73d1876b92ed94d9ae07904ff70dd7b3d736ef635321d01609dc79e72b04c049(v0.156.0–v0.158.0) tobaa047b3132cecce0c44ff9880ddf0edf0e6c8e390cec68bb4c2bb801b6b4861. The release republishes it with sha verification. The sweep orchestrator's deploy checklist will show a code-only deploy: deploy the orchestrator from the release.What is removed
Mirror the pinned AWS CLI to S3(scripts/mirror-awscli.sh publish: download, gpg-verify, upload to all 11 buckets, prune old versions).github/workflows/release.yamlVerify the AWS CLI mirror(anonymous HTTPS read-back from every bucket)scripts/mirror-awscli.shscripts/scripts/verify-awscli-pin.sh, which only checks (see below)spawn_need_awspkg/launcher/bootstrap.gospawn_need_aws's REGION argument,$SPAWN_PX_REGION, andawsCLIMirrorDirAWSCLIPin.MirrorKey(public API, breaking on 0.x) and the fourth column of the hiddenspawn awscli-pinpkg/launcher,cmd/awscli_pin.goWhytext saying the bucket serves the AWS CLIpkg/aws/private_network.gobootstrap_awscli_mirror_test.go,release_awscli_mirror_test.goKept: the pin (version and both sha256s), the weekly bump workflow (#1495), and the release-time check that the pinned origin zips verify. That check used to live inside the mirror's
publishstep. It's now a step of its own,Verify the pinned AWS CLI at its origin(scripts/verify-awscli-pin.sh), and still runs before GoReleaser:FB5DB77F…475C..sigare downloaded fromawscli.amazonaws.com.gpg --verifymust pass, with aVALIDSIGby that fingerprint.It needs no AWS credentials, uploads nothing, and removes what it downloaded.
EFA installer mirror (second commit)
Note
This is per-launch MPI user data (
pkg/userdata), not the signed bootstrap body. The body sha above is unaffected by it.--efaused to tryhttps://spawn-binaries-<region>.s3.<region>.amazonaws.com/spawn/efa/aws-efa-installer-1.51.0.tar.gzfirst. The release never published that copy (#1507 was closed as won't-do), so every--efamember got a 403 there before falling back to the origin. Every live run shows it.https://efa-installer.amazonaws.com/aws-efa-installer-1.51.0.tar.gz. It still requires the pinned sha256, and a member without a matching tarball still fails closed with anmpi-bootstraprecord.efaInstallerSources,efaInstallerMirrorPrefix, the template'sEFASourcesand its source loop.EFAURLreplaces them.efa-pin.yml, and the release stepVerify the pinned EFA installer.--bootstrap-egress proxy: the one fetch goes through the proxy. Theno_proxycomments no longer mention an EFA mirror.spawn-built AMIs (second commit)
An image made by
spawn create-amicarriesspawn:created-fromandspawn:base-ami(cmd/create_ami.go), plusspawn:source-region. The preflight judges such an image by its base:ec2:DescribeImages(same IAM action), inspawn:source-regionwhen that tag is set.spawn:created-fromis missing, or the base is unreadable or deregistered, not Amazon Linux, or more than 3 hops deep, the image still counts as needing the download, and the need says why.Every AWS CLI need now reads "…; a NAT route or --bootstrap-egress proxy reaches it (awscli.amazonaws.com)". The overall refusal already lists NAT and the flag.
Bootstrap
spawn_need_awsnow fetches onlyhttps://awscli.amazonaws.com/awscli-exe-linux-$(uname -m)-2.39.3.zip, and installs it only if it has the pinned sha256. A mismatch or a failed download fails closed, as before.--bootstrap-egress proxy(#1523) still works. The per-launch call before the body is nowhttp_proxy=… https_proxy=… no_proxy=… spawn_need_aws || true, so "mirror direct, then origin via proxy" becomes "origin via proxy".no_proxyneeded no change: it never had a mirror-specific entry. S3 (.s3.<region>.amazonaws.comand its other forms) still bypasses the proxy for spored, the EFA installer mirror and AL2023's repositories. Only comments changed.Sizes:
Preflight: how spawn tells whether the image has the AWS CLI
TargetOSonly separates Windows from Linux. Nothing in spawn records the Linux distribution, and the MPI/apt Ubuntu handling detects it at boot, in shell.PlatformDetailsisLinux/UNIXfor both AL and Canonical Ubuntu.So
PreflightNoPublicIPmakes one cachedec2:DescribeImagescall, and only when the subnet has no NAT gateway or working NAT instance. Launch already callsDescribeImages, so no new IAM is needed.ImageOwnerAlias == "amazon"(no other account can carry that alias), and the name or description says Amazon Linux (al2023-ami-*,amzn2-ami-*,amzn-ami-*, or "Amazon Linux"), and nothing says Ubuntu. This covers AL2023, AL2, the AL2023 DLAMIs spawn picks for GPU types, and ECS/EKS-optimized images.spawn create-amiimage. spawn can't see what's installed, so it doesn't guess. Such a launch gets the internet needthe Linux bootstrap's AWS CLI download, as image ami-… is not Amazon's Amazon Linux and may have no aws CLI (stock Ubuntu has none) (awscli.amazonaws.com).--bootstrap-egress proxy.ViaEgressProxy, soensureEgressProxycreates or reuses a proxy.awscli.amazonaws.comis already onegressproxy.Allowlist, and a test asserts it.Known cost: a no-NAT private launch of a custom AL-based AMI that
spawn create-amididn't build is now refused unless opted in. With the mirror it worked. Its metadata can't show that it has the CLI.create-amiimages are handled; see above.Sweeps don't support the proxy yet (phase 3 refuses it). So a no-NAT
--no-public-ipUbuntu sweep, foreground or--detach, is now refused at the preflight and needs a NAT route.--no-public-ipand--bootstrap-egresshelp text are updated, anddocs-gen/launch.mdis regenerated.Tests and revert evidence
Every revert below compiled and failed its gate. All were restored afterwards.
TestAWSCLIOnlyFromTheOriginAndShaChecked(boot sandbox, 5 cases; the old mirror key is served and counted)bootstrap.gofrom origin/main (mirror first)the retired regional mirror eu-west-1/spawn/awscli/… was fetched 1 times, want 0;no origin: the old mirror is not a fallback:bootstrap error = <nil>, want success falseTestAWSCLIInstalledWhenAbsenttruean origin zip that is not the pin is never run: exit 0;a zip that is not the pinned one:exited 0 with no aws CLITestSpawnNeedAWSFetchesNothingButTheOrigin,TestAWSCLIOriginsAreOnTheEgressAllowlistcontains "spawn-binaries",".s3.","$1";fetches from a templated host spawn-binaries-$region…TestAWSCLIOriginThroughTheEgressProxyspawn-binaries-eu-west-1…,not the origin through the proxyran with {… no proxy …},not the origin through the proxyTestPreflightNoPublicIPAWSCLIDownload,TestLaunch_NoPublicIPUbuntuWithoutNATIsRefusedimageAWSCLINeedreturns no needUbuntu without NAT or opt-in: err = <nil>, want the refusal; Launch not refusedTestImageShipsAWSCLIan AL name not Amazon's: imageShipsAWSCLI = trueTestPreflightNoPublicIPUnreadableImageNeedsTheDownloaderr = <nil>, want the refusal naming awscli.amazonaws.comTestPreflightNoPublicIPReadsTheImageOnlyWithoutNAT1 DescribeImages calls behind a NAT route, want 0TestReleaseRefusesAnUnverifiedAWSCLIPin(real gpg, throwaway key, 6 cases)validly signed but not the pinned sha256:the check passedTestReleaseAWSCLIPinRequiresThePinnedSigner&& $NF == fprremoveda zip signed by a key other than the pinned one passedTestReleaseVerifiesTheAWSCLIPinBeforeTheCLIrelease.yamlfrom origin/main (mirror steps back)found 0 "Verify the pinned AWS CLI at its origin" steps(it also rejects any step namingmirror-awscliorspawn/awscli)TestReleaseVerifiesThePinnedAWSCLIaws s3 cpthe AWS CLI pin check called aws (it must upload nothing)TestEFAInstallerNotThePinnedOneIsNeverUnpackedOrRun,TestEFAInstallerOnlyFromTheOrigin,TestEFAPinIsTheGoSourceOfTruth,TestEFAThroughTheEgressProxyefa.goandmpi.gofrom origin/main (mirror first)fetched [spawn-binaries-us-east-1…/spawn/efa/… efa-installer…];tampered at the origin, a good old mirror copy:rank 0 exited 0, want 1truean EFA installer ran from a tarball that is not the pinned one: "TAMPERED"TestSpawnBuiltImageIsJudgedByItsBase(8 cases),TestPreflightNoPublicIPSpawnBuiltALImageNeedsNothingbuilt from AL2023: need is not empty, andDescribeImages calls [top], want [top base]; the wire test is refusedspawn:created-fromnot requireda base tag without spawn:created-from is not create-ami's:need = "", want a needthe base cannot be read (deregistered):need = ""Updated, not new:
privateFakeanswersDescribeImageswith Amazon's AL2023, so existing no-NAT wire tests keep passing for the right reason.privateCfgnames an AMI.SPAWN_PX_REGION.Checks
These pass:
make checkmake lint: 0 issues in all 10 modules.go test ./..., with the AWS env stripped: rc 0.go test -tags e2e_tier0 ./test/e2e/semgrep scan --config=auto --error .: rc 0.actionlint .github/workflows/release.yamlshellcheck scripts/verify-awscli-pin.shmake gen-docsandmake api-snapshotwere regenerated and committed. The only change toapi/public-surface.txtis thatfield AWSCLIPin.MirrorKeyis removed.No AWS calls were made.
Not done here (owner, live, after merge)
AWSCLIMirrorfromGitHubActions-spore-host-release, and only after this PR is merged. Until then, a release from main still runs the mirror step and would stop there, before GoReleaser.spawn/awscli/inspawn-binaries-{us-east-1,us-east-2,us-west-1,us-west-2,ca-central-1,eu-west-1,eu-west-2,eu-central-1,ap-southeast-1,ap-southeast-2,ap-northeast-1}.awscli.amazonaws.com. Deleting is safe for any instance that has internet or the proxy.spawn/awscli/*, it can go with the objects.