Repository navigation
feat(windows): full connect — launch defaults, RDP, SSH-over-SSM (#95) - #99
Merged
Merged
Conversation
Make spawn handle the whole Windows lifecycle: launch sensibly, connect by both RDP and SSH-over-SSM. A live test of an imported Win11 client AMI surfaced the gaps this fixes. Launch (cmd/launch.go, pkg/aws/client.go): - Default --os windows to m7i.xlarge and REJECT burstable t-instances for Windows (guardWindowsInstanceType): Sysprep first boot starves on burst CPU credits (~20+ min on t3.large in testing). - Open a managed Windows security group (CreateOrGetWindowsSecurityGroup) with RDP 3389 + SSH 22, CIDR-restrictable via --allow-cidr (default 0.0.0.0/0 with a warning). Previously Windows fell back to the default SG so RDP was impossible. - Windows readiness waits on WaitForPasswordData (the real post-Sysprep "usable" signal), not an SSH-22 probe that won't answer; the success/DNS hints now show `spawn connect <name> --rdp` instead of a bogus Linux `ssh ec2-user@`. Connect (cmd/connect.go): - New `spawn connect --rdp` for Windows: decrypts the Administrator password and opens Remote Desktop — direct to the public IP, or `--via-ssm` (auto when no public IP) over an AWS-StartPortForwardingSession tunnel to localhost:--rdp-port. rdpClientCommand picks mstsc/open-rdp/xfreerdp per OS; credentials are printed. - Reuses existing primitives (WaitForPasswordData/DecryptWindowsPassword, findSSHKey, the SSM start-session shell-out). Default (no --rdp) behavior intact. SSM agent (buildWindowsUserData): - Ensure AmazonSSMAgent is installed, set Automatic, and started. Stock Windows Server AMIs ship it running, but the imported client AMI bakes it without auto-start after Sysprep, so SSM never registered and SSH-over-SSM failed. Tests: burstable/guard, RDP command per-OS, default-type-non-burstable. make check + e2e tier0 green. Live verification (launch + both connect paths) next. Refs #95.
The Windows instance-type default must be set BEFORE launchMode() runs: launchMode treats an empty --instance-type as "go to the wizard (TTY) or pipe mode", so `spawn launch <name> --os windows` with no --instance-type never reached the flags path and dropped into the interactive wizard. Apply the default to the instanceType var up front; the later validation just errors for a genuine non-Windows omission now. Refs #95.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Makes spawn handle the whole Windows lifecycle: launch sensibly, connect by both
RDP and SSH-over-SSM. Verified end-to-end on a real imported Win11 instance.
Launch (cmd/launch.go, pkg/aws/client.go)
--os windowsto m7i.xlarge and reject burstable t-instancesfor Windows — Sysprep first boot starves on burst CPU credits (~20 min on
t3.large in testing). Default applied before launchMode so
--os windowswithno
--instance-typetakes the flags path instead of dropping to the wizard.via
--allow-cidr(default 0.0.0.0/0 with a warning). Previously Windows fellback to the default SG → RDP impossible.
"usable" signal), not an SSH-22 probe; success/DNS hints show
spawn connect <name> --rdp, not a bogus Linuxssh ec2-user@.Connect (cmd/connect.go)
spawn connect --rdp: decrypts the Administrator password and opensRemote Desktop — direct to the public IP, or
--via-ssm(auto when no publicIP) over an
AWS-StartPortForwardingSessiontunnel tolocalhost:--rdp-port.rdpClientCommandpicks mstsc / open-rdp / xfreerdp per OS.findSSHKey, the SSM start-session shell-out). Default (no
--rdp) intact.SSM agent (buildWindowsUserData)
Server AMIs ship it running, but the imported client AMI baked it without
auto-start, so SSM never registered.
Verified live (instance terminated + leak-checked)
spawn connect win -- <ps>→ ran over SSM (returned hostname / nt authority\system).spawn connect win --rdp→ decrypted password + launched RDP client.spawn connect win --rdp --via-ssm→ "Port 13389 opened", local port forwards to 3389.Tests: burstable guard, RDP command per-OS, default-type-non-burstable.
make check+ e2e tier0 green.Note: SSM registers only after the imported AMI's ~30+ min Sysprep first boot —
the warm-AMI optimization (#98) is the real per-launch perf fix and pairs with this.
Closes #95.