Skip to content

feat(windows): target-OS-aware launch + Windows connect (#55 Phase 1) - #82

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/55-windows-phase1
Jun 8, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/55-windows-phase1

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Summary

Phase 1 of Windows support (#55): makes spawn launch/connect first-class for Windows, SSM-first. Builds on the key-normalization work (RSA-on-Windows) and the Windows password helper already shipped in v0.37.1. Full in-instance spored on Windows is out of scope (#77) — the server-side reaper (#70) is the lifecycle backstop, so Windows launches require --ttl.

Launch

  • LaunchConfig.TargetOS + a spawn:os tag. resolveTargetOS picks the OS from an explicit --os flag, else auto-detects via aws.IsWindowsAMI. Wired into the single-instance and sweep paths.
  • windowsLifecycleGuard: a Windows launch errors without --ttl (no agent → no idle-timeout) and warns loudly that only the TTL deadline + reaper will stop it.
  • buildUserData → buildWindowsUserData for Windows: a minimal <powershell> EC2Launch block that enables OpenSSH and installs the spawn RSA public key into administrators_authorized_keys (no spored). encodeUserDataForOS uses plain base64 for Windows (EC2Launch doesn't gunzip) vs gzip+base64 for Linux. Linux EFS/FSx mount scripting is skipped on Windows.

Connect

  • spawn:os=windows → connectWindows: fetch + decrypt the Administrator password (RSA launch key), print it with RDP instructions (mstsc /v:<ip>, or SSM port-forward when no public IP), then open an SSM PowerShell session. connect -- <cmd> runs via the new aws.RunPowerShell (SSM AWS-RunPowerShellScript) helper. Linux connect unchanged.

Verified on real AWS (dev)

  • Windows launch: auto-detected spawn:os=windows, RSA key registered, no-agent warning, TTL deadline set, boots + SSM online.
  • spawn connect: decrypted the real Administrator password, printed RDP instructions, opened SSM PowerShell.
  • spawn connect -- "hostname; whoami": returned output via SSM RunCommand.
  • Negative: Windows launch without --ttl errors with guidance, no instance created.
  • Linux regression: AL2023 launch → spawn:os=linux, ed25519 key, connect works.
  • All instances terminated immediately (Windows has no spored); zero leaks across regions.

Scope / safety

CLI-only (no spored/instance change) → bump 0.37.2 → 0.37.3.

Refs #55. Depends-on #77 for full lifecycle parity.

Makes spawn launch/connect first-class for Windows (SSM-first). Full in-instance
spored on Windows remains out of scope (#77); the server-side reaper (#70) is the
lifecycle backstop, so Windows launches require --ttl.

Launch:
- New LaunchConfig.TargetOS + spawn:os tag. resolveTargetOS picks the OS from an
  explicit --os flag, else auto-detects via aws.IsWindowsAMI. Wired into the
  single-instance and sweep paths.
- windowsLifecycleGuard: Windows launch REQUIRES --ttl (no agent → no
  idle-timeout) and warns loudly that only the TTL deadline + reaper will stop
  it.
- buildUserData branches to buildWindowsUserData for Windows: a minimal
  <powershell> EC2Launch block that enables OpenSSH and installs the spawn RSA
  public key into administrators_authorized_keys (no spored). encodeUserDataForOS
  uses plain base64 for Windows (EC2Launch doesn't gunzip) vs gzip+base64 for
  Linux. EFS/FSx Linux mount scripting is skipped on Windows.

Connect:
- spawn:os=windows routes to connectWindows: fetch + decrypt the Administrator
  password (RSA launch key via WaitForPasswordData + DecryptWindowsPassword),
  print it with RDP instructions (mstsc /v:<ip>, or SSM port-forward when no
  public IP), then open an SSM PowerShell session. `connect -- <cmd>` runs via
  the new aws.RunPowerShell (SSM AWS-RunPowerShellScript) helper.
- Linux connect unchanged.

Verified on real AWS (dev): Windows launch auto-detected OS + tag + RSA key +
no-agent warning; connect decrypted the real Administrator password and opened
SSM, and `connect -- "hostname; whoami"` returned output via SSM RunCommand; the
no-TTL guard blocked a Windows launch with no instance created; AL2023
regression (spawn:os=linux, ed25519, connect works) intact. All instances
terminated; zero leaks. Bump 0.37.2 → 0.37.3.

Refs #55. Depends-on #77 for full lifecycle parity.
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 128 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/connect.go 0.00% 60 Missing ⚠️
pkg/aws/ssm.go 0.00% 39 Missing ⚠️
cmd/launch.go 70.11% 26 Missing ⚠️
pkg/aws/client.go 50.00% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 73d5656 into main Jun 8, 2026
3 checks passed
@scttfrdmn
scttfrdmn deleted the feat/55-windows-phase1 branch June 8, 2026 21:19
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