Skip to content

fix(bootstrap): fetch spored from the regional S3 name; pre-flight counts an S3 interface endpoint (#1436) - #1466

Merged
scttfrdmn merged 2 commits into
mainfrom
fix/1436-regional-s3
Oct 31, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
fix/1436-regional-s3

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1436

Every S3 name the bootstrap and spored's install paths use at boot is now the regional virtual-hosted name, so a --no-public-ip instance gets spored through an S3 interface endpoint with private DNS, not only through a gateway endpoint or NAT.

URL inventory

Where Before After
Release stub (user data), pkg/launcher/bootstrap.go spawn-binaries-${SPAWN_BS_REGION:-us-east-1}.s3.amazonaws.com, then spawn-binaries-us-east-1.s3.amazonaws.com spawn-binaries-${R}.s3.${R}.amazonaws.com, then spawn-binaries-us-east-1.s3.us-east-1.amazonaws.com
Bootstrap body (published, and inline for dev builds) spawn-binaries-${REGION}.s3.amazonaws.com / us-east-1 global regional / us-east-1 regional
spawn upgrade-spored SSM script, cmd/upgrade_spored.go global pair regional pair
App web + DCV user data, cmd/app.go (x2) global pair regional pair
App TLS cert copy, cmd/app.go (x4) aws s3 cp (no --region) aws s3 cp --region "$REGION"
Pipeline stage script, lambda/pipeline-orchestrator global pair regional pair
Windows SSM agent download (AMI without one), cmd/launch_config.go s3.amazonaws.com/ec2-downloads-windows/... amazon-ssm-${region}.s3.${region}.amazonaws.com/latest/... (region lookup moved ahead of it)
Windows spored install, pkg/sporedinstall/windows.go aws s3 cp --region <bucket's region> unchanged (already regional)
Staged command/flush hook fetch aws s3 cp --region unchanged
Body check in deploy-sweep-orchestrator.sh, scripts/deploylambdas (operator side) us-east-1 global us-east-1 regional (same object)

Unchanged, not bootstrap: the task wrapper's and queue runner's aws s3 cp have no --region. AWS CLI v2 takes the region from IMDS and sends us-east-1 to the regional name too (botocore's AWS::S3::UseGlobalEndpoint is hardcoded False in the v2 CLI; checked in awscli 2.39.3's bundled botocore). Plugins come from GitHub, not S3. The signing key is compiled in.

Region/bucket mapping

The release publishes to 11 spawn-binaries-<region> buckets (SPAWN_BINARY_BUCKETS). Elsewhere the regional fetch finds no bucket and the us-east-1 fallback is the only source. That fallback is kept, now under its own regional name. It is cross-region, so no VPC endpoint can serve it. This PR adds sporedinstall.PublishedRegions(), gated against the release workflow's list, and the pre-flight now refuses --no-public-ip in an unpublished region unless there is NAT (or --allow-missing-endpoints). Before, such an instance retired itself at boot.

Pre-flight (pkg/aws/private_network.go)

  • s3 now counts an interface endpoint with private DNS (GatewayOnly removed).
  • It does not count an interface endpoint set to private DNS only for inbound Resolver endpoints: the VPC's own instances resolve to the gateway endpoint then. Read from DnsOptions into the new PrivateEndpoint.InboundResolverOnly.

Published bootstrap body: CHANGES

Only the two bucket-URL lines differ. On this branch spawn bootstrap-body gives sha256 a1b83f4b... where main gave 925521a3.... The stub embeds the sha of the body its own build renders, and deploy-sweep-orchestrator.sh/deploylambdas compare the published body with the one the tag renders. All of that stays self-consistent per release, so there is no pinned sha to update. Signed spored objects (.sha256, .sig) are untouched; only the hostname used to fetch them changes.

Size

  • Linux bare bootstrap (inline): 7133 -> 7138 bytes gzipped (budget 8192)
  • Release stub: 1799 -> 1804 bytes gzipped (budget 3072)
  • Windows user data: 8544 -> 8627 bytes raw

Gates

  • internal/s3hosts: finds every S3 URL (region variables resolved to the launch region; an unknown variable in a host fails), every aws s3/s3api call and every Windows source entry in a rendered script.
  • pkg/launcher TestEveryBootstrapS3HostIsRegional: the stub, the inline bootstrap and the published body, for eu-west-2.
  • cmd TestEveryGeneratedScriptS3HostIsRegional: boot bootstrap, SSM upgrade, 4 app user data, Windows bootstrap, and the Windows release install.
  • cmd TestNoSourceUsesTheGlobalS3Name: a sweep of 605 non-test .go/.sh/.ps1/.yaml/.py source files.
  • lambda/pipeline-orchestrator TestStageUserDataS3HostsAreRegional.
  • Root TestPublishedRegionsAreTheReleaseBuckets.
  • The pkg/launcher boot sandbox now only rewrites the regional names, so a global URL 404s there.

Each gate was watched failing against a compiling revert: the stub URL, body URL, body fallback, Windows SSM URL, app cert --region, upgrade URL, pipeline URL, the deploylambdas URL (sweep), a dropped published region, the unpublished-region refusal, the inbound-only check, and the DnsOptions read.

Not verified against AWS

Per the issue, the claim that an S3 interface endpoint's private DNS serves *.s3.<region>.amazonaws.com and not *.s3.amazonaws.com comes from the S3 PrivateLink docs, not a live test. So does the amazon-ssm-<region> bucket URL, which is in the SSM agent's Windows install docs. No AWS calls were made.

Checks: make check, make lint (0 issues in 10 modules), semgrep --config=auto (0 findings), make check-docs all clean; make api-snapshot committed.

@scttfrdmn scttfrdmn added this to the v0.153.0 milestone Oct 31, 2026
@codecov

codecov Bot commented Oct 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.23529% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/sporedinstall/install.go 0.00% 9 Missing ⚠️
internal/s3hosts/s3hosts.go 97.82% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn force-pushed the fix/1436-regional-s3 branch from 77e8a0c to 678918e Compare October 31, 2026 19:25
@scttfrdmn
scttfrdmn merged commit 45dec07 into main Oct 31, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1436-regional-s3 branch October 31, 2026 19:48
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.

bootstrap: fetch spored from the regional S3 name so an S3 interface endpoint serves a private-only instance

1 participant