Repository navigation
Use the Windows AMI for launch-windows by default - #32
Draft
claude[bot] wants to merge 1 commit into
Draft
claude[bot] wants to merge 1 commit into
claude[bot] wants to merge 1 commit into
Conversation
GetAndValidateAmi replaced every named alias with the result of architecture detection, which only returns Amazon Linux aliases. The "windows" alias (the launch-windows default) was therefore unreachable and Windows bastions were launched from an Amazon Linux 2023 image. Only Amazon Linux aliases (and unrecognised names, as before) are now resolved by instance architecture; other named aliases map directly to their SSM parameter. Adds unit tests for the alias resolution.
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.
Before:
bastion launch-windowswith the default--ami windowslaunched an Amazon Linux 2023 instance, not Windows Server 2019. With--rdp, no Windows password is ever produced, so the command fails after the instance is already running.After:
launch-windowslaunches from the Windows Server 2019 Base image (/aws/service/ami-windows-latest/Windows_Server-2019-English-Full-Base) as the flag help says.launchandport-forwardbehave as before:amazon-linuxstill picks the x86_64 or arm64 AL2023 image to match the instance type.How:
GetAndValidateAmioverwrote every named alias with the output ofGetArchitecture, which only ever returnsamazon-linuxoramazon-linux-arm64, so thewindowsentry in theamismap could never be reached. Architecture detection was added in #16 for Amazon Linux. Alias resolution now lives in a smallamiParameterForAliashelper. Amazon Linux aliases, and unrecognised names (unchanged fallback), are still resolved by architecture. Any other named alias, currently justwindows, maps straight to its own SSM parameter. AMI IDs (ami-...) and SSM parameter paths (/...) are handled exactly as before.Verification
go build ./...andgo vet ./bastion/are clean, andgofmt -l .reports nothing.bastion/ami_test.go, which tests alias resolution with a stubbed architecture lookup: windows is not replaced, amazon-linux follows x86_64/arm64, unknown names fall back to architecture detection, and lookup errors are passed back.go test ./bastion/passes on Go 1.24. The code only uses APIs that exist in Go 1.16, the version CI uses.bastion launch-windowsin an account launches an instance whosePlatformiswindows.No version file to bump: the release version comes from the git tag through ldflags/goreleaser.