Skip to content

feat(bootstrap)!: retire the AWS CLI regional mirror; preflight counts the AWS CLI download (#1515 phase 7) - #1529

Merged
scttfrdmn merged 2 commits into
mainfrom
feat/1515-retire-awscli-mirror
Nov 5, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
feat/1515-retire-awscli-mirror

Conversation

@scttfrdmn

@scttfrdmn scttfrdmn commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

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) to baa047b3132cecce0c44ff9880ddf0edf0e6c8e390cec68bb4c2bb801b6b4861. 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

Piece Where Now
Release step 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.yaml removed
Release step Verify the AWS CLI mirror (anonymous HTTPS read-back from every bucket) same removed
scripts/mirror-awscli.sh scripts/ replaced by scripts/verify-awscli-pin.sh, which only checks (see below)
The mirror-first attempt in spawn_need_aws pkg/launcher/bootstrap.go origin only
spawn_need_aws's REGION argument, $SPAWN_PX_REGION, and awsCLIMirrorDir same gone (the region existed only for the mirror URL)
AWSCLIPin.MirrorKey (public API, breaking on 0.x) and the fourth column of the hidden spawn awscli-pin pkg/launcher, cmd/awscli_pin.go gone
The S3 Why text saying the bucket serves the AWS CLI pkg/aws/private_network.go corrected
Mirror tests: bootstrap_awscli_mirror_test.go, release_awscli_mirror_test.go replaced (see Tests)

Kept: 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 publish step. 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:

  • The committed key file must hold exactly one primary key, FB5DB77F…475C.
  • Each pinned zip and its .sig are downloaded from awscli.amazonaws.com.
  • gpg --verify must pass, with a VALIDSIG by that fingerprint.
  • The zip must have the pinned sha256.

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.

--efa used to try https://spawn-binaries-<region>.s3.<region>.amazonaws.com/spawn/efa/aws-efa-installer-1.51.0.tar.gz first. The release never published that copy (#1507 was closed as won't-do), so every --efa member got a 403 there before falling back to the origin. Every live run shows it.

  • Now: the MPI user data fetches only 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 an mpi-bootstrap record.
  • Removed: efaInstallerSources, efaInstallerMirrorPrefix, the template's EFASources and its source loop. EFAURL replaces them.
  • No release-side mirror code existed, so the release needed no change.
  • Kept: the pin, efa-pin.yml, and the release step Verify the pinned EFA installer.
  • With --bootstrap-egress proxy: the one fetch goes through the proxy. The no_proxy comments no longer mention an EFA mirror.

spawn-built AMIs (second commit)

An image made by spawn create-ami carries spawn:created-from and spawn:base-ami (cmd/create_ami.go), plus spawn:source-region. The preflight judges such an image by its base:

  • It reads the base with one more ec2:DescribeImages (same IAM action), in spawn:source-region when that tag is set.
  • It follows up to 3 spawn-built hops, and applies the same owner-alias and name rule.
  • If the base is Amazon's Amazon Linux, nothing is needed.
  • If the tag is absent, or spawn:created-from is 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.
  • Verdicts are cached per region and AMI.

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_aws now fetches only https://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 now http_proxy=… https_proxy=… no_proxy=… spawn_need_aws || true, so "mirror direct, then origin via proxy" becomes "origin via proxy".

no_proxy needed no change: it never had a mirror-specific entry. S3 (.s3.<region>.amazonaws.com and its other forms) still bypasses the proxy for spored, the EFA installer mirror and AL2023's repositories. Only comments changed.

Sizes:

Before After Budget
Published body (raw) 23665 23606
Inline bare bootstrap (gzipped) 7991 7963 9088
Stub (gzipped) 1842 1838 3072

Preflight: how spawn tells whether the image has the AWS CLI

TargetOS only separates Windows from Linux. Nothing in spawn records the Linux distribution, and the MPI/apt Ubuntu handling detects it at boot, in shell. PlatformDetails is Linux/UNIX for both AL and Canonical Ubuntu.

So PreflightNoPublicIP makes one cached ec2:DescribeImages call, and only when the subnet has no NAT gateway or working NAT instance. Launch already calls DescribeImages, so no new IAM is needed.

  • Ships the CLI, needs nothing: 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.
  • Anything else on Linux may lack it: stock Ubuntu, RHEL, a custom, marketplace or spawn create-ami image. spawn can't see what's installed, so it doesn't guess. Such a launch gets the internet need the 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).
    • Without the opt-in: refused, with the existing remedy text naming --bootstrap-egress proxy.
    • With it: met "through the spawn egress proxy in vpc-…" and recorded in ViaEgressProxy, so ensureEgressProxy creates or reuses a proxy. awscli.amazonaws.com is already on egressproxy.Allowlist, and a test asserts it.
  • An image spawn can't read counts as needing the download, and the preflight prints why. Refusing is the side the user can opt past.
  • Windows is unchanged: it already had its own NAT-only need.

Known cost: a no-NAT private launch of a custom AL-based AMI that spawn create-ami didn't build is now refused unless opted in. With the mirror it worked. Its metadata can't show that it has the CLI. create-ami images are handled; see above.

Sweeps don't support the proxy yet (phase 3 refuses it). So a no-NAT --no-public-ip Ubuntu sweep, foreground or --detach, is now refused at the preflight and needs a NAT route.

--no-public-ip and --bootstrap-egress help text are updated, and docs-gen/launch.md is regenerated.

Tests and revert evidence

Every revert below compiled and failed its gate. All were restored afterwards.

Gate Revert Failure
TestAWSCLIOnlyFromTheOriginAndShaChecked (boot sandbox, 5 cases; the old mirror key is served and counted) bootstrap.go from 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 false
same, plus TestAWSCLIInstalledWhenAbsent sha comparison replaced by true an 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 CLI
TestSpawnNeedAWSFetchesNothingButTheOrigin, TestAWSCLIOriginsAreOnTheEgressAllowlist same origin/main revert contains "spawn-binaries", ".s3.", "$1"; fetches from a templated host spawn-binaries-$region…
TestAWSCLIOriginThroughTheEgressProxy origin/main body first fetch is spawn-binaries-eu-west-1…, not the origin through the proxy
same proxy env dropped from the per-launch call ran with {… no proxy …}, not the origin through the proxy
TestPreflightNoPublicIPAWSCLIDownload, TestLaunch_NoPublicIPUbuntuWithoutNATIsRefused imageAWSCLINeed returns no need Ubuntu without NAT or opt-in: err = <nil>, want the refusal; Launch not refused
TestImageShipsAWSCLI owner-alias check disabled an AL name not Amazon's: imageShipsAWSCLI = true
TestPreflightNoPublicIPUnreadableImageNeedsTheDownload unreadable image treated as AL err = <nil>, want the refusal naming awscli.amazonaws.com
TestPreflightNoPublicIPReadsTheImageOnlyWithoutNAT image read even behind NAT 1 DescribeImages calls behind a NAT route, want 0
TestReleaseRefusesAnUnverifiedAWSCLIPin (real gpg, throwaway key, 6 cases) sha check removed from the script validly signed but not the pinned sha256: the check passed
TestReleaseAWSCLIPinRequiresThePinnedSigner && $NF == fpr removed a zip signed by a key other than the pinned one passed
TestReleaseVerifiesTheAWSCLIPinBeforeTheCLI release.yaml from origin/main (mirror steps back) found 0 "Verify the pinned AWS CLI at its origin" steps (it also rejects any step naming mirror-awscli or spawn/awscli)
TestReleaseVerifiesThePinnedAWSCLI the script re-gains an aws s3 cp the AWS CLI pin check called aws (it must upload nothing)
TestEFAInstallerNotThePinnedOneIsNeverUnpackedOrRun, TestEFAInstallerOnlyFromTheOrigin, TestEFAPinIsTheGoSourceOfTruth, TestEFAThroughTheEgressProxy efa.go and mpi.go from 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 1
same EFA sha comparison replaced by true an EFA installer ran from a tarball that is not the pinned one: "TAMPERED"
TestSpawnBuiltImageIsJudgedByItsBase (8 cases), TestPreflightNoPublicIPSpawnBuiltALImageNeedsNothing base tag ignored built from AL2023: need is not empty, and DescribeImages calls [top], want [top base]; the wire test is refused
same spawn:created-from not required a base tag without spawn:created-from is not create-ami's: need = "", want a need
same an unreadable base trusted the base cannot be read (deregistered): need = ""

Updated, not new:

  • privateFake answers DescribeImages with Amazon's AL2023, so existing no-NAT wire tests keep passing for the right reason.
  • privateCfg names an AMI.
  • The cmd job-array test looks for the proxied call without SPAWN_PX_REGION.

Checks

These pass:

  • make check
  • make lint: 0 issues in all 10 modules.
  • Hermetic 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.yaml
  • shellcheck scripts/verify-awscli-pin.sh

make gen-docs and make api-snapshot were regenerated and committed. The only change to api/public-surface.txt is that field AWSCLIPin.MirrorKey is removed.

No AWS calls were made.

Not done here (owner, live, after merge)

  1. The release role's IAM. Remove the inline policy AWSCLIMirror from GitHubActions-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.
  2. The S3 objects. Delete everything under spawn/awscli/ in spawn-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}.
    • CLIs v0.156.0–v0.158.0 try the mirror first and fall back to awscli.amazonaws.com. Deleting is safe for any instance that has internet or the proxy.
    • It breaks those versions' no-NAT, no-proxy Ubuntu launches. Their preflight doesn't refuse, and their bootstrap then fails closed after spored is running.
    • So delete only after the release carrying this PR ships, ideally once users have moved off v0.156–v0.158.
  3. If the bucket policy has a statement specific to spawn/awscli/*, it can go with the objects.

…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

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.06173% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/aws/image_awscli.go 93.44% 4 Missing ⚠️

📢 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
@scttfrdmn

Copy link
Copy Markdown
Contributor Author

Live test at ac76e89b: PASS (aws account, us-east-1, no-NAT VPC, spored v0.158.0)

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.

@scttfrdmn
scttfrdmn merged commit fd42134 into main Nov 5, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the feat/1515-retire-awscli-mirror branch November 5, 2026 03:13
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.

1 participant