Repository navigation
Closed
Labels
Description
Summary (exploration, not yet a commitment)
Launching a Windows instance on EC2 is mechanically the same as Linux (RunInstances with a Windows AMI). What's fundamentally different is how we connect to it and how spored monitors it. This issue is to scope what a Windows path would actually require, before deciding whether to build it.
What's different on Windows
Connection:
- No SSH by default — Windows uses RDP (port 3389) and/or WinRM / SSM Session Manager.
- Initial credential is the Administrator password, retrieved via
GetPasswordData+ decrypted with the private key (not an SSH key login).spawn connect's SSH model doesn't map. connect --command(one-shot exec) would need WinRM or SSM RunCommand instead of SSH.
spored / monitoring:
- spored is a Linux systemd daemon. Windows needs it as a Windows Service (or a scheduled task), and the bootstrap is PowerShell user-data (
<powershell>...</powershell>), not bash. - Idle detection, completion-file watching, TTL enforcement, cost accounting — the logic ports (it's Go), but every OS touchpoint (process/CPU sampling, service management, paths, the completion file) needs a Windows implementation.
- The spored install script (curl from S3 + systemd) is entirely Linux-shaped.
Other:
- Windows AMIs are larger (bigger root volume floor — spawn launch: should auto-detect minimum volume size from AMI snapshot #25 helps here) and licensing cost differs (Windows hourly includes the license) — affects the cost model (Audit cost accumulation for accuracy — include EBS, public IPv4, etc. across all instance states #51).
- SSH user /
ec2-userassumptions (#-multi-OS issue) are moot; it's a different access model entirely.
Questions to answer in this exploration
- Connection model: RDP, WinRM, or standardize on SSM Session Manager (no inbound ports, works for both exec and interactive)? SSM is likely the cleanest fit and would also benefit Linux.
- Does spored become a cross-platform binary with a Windows service wrapper, or a separate agent?
- Minimum viable: maybe just launch + cost/TTL via tags + terminate (no in-instance agent) as a first step, deferring full spored parity?
- How much of
connect/status/extendcan be made transport-agnostic (SSM) vs needs Windows-specific code?
Context
Exploration request. Output should be a recommendation (SSM-first?) + a phased scope, not code. Depends conceptually on the multi-OS work and the cost audit (#51).
Activity
scttfrdmn commentedon Jun 8, 2026
Spike results (real Windows launch, 2026-06-08)
Launched a Windows Server 2022 instance (
ami-0909cee4864578472, t3.large, dev account) to validate the connection + monitoring assumptions end-to-end. Instance terminated immediately after; zero leaks verified across regions. Recommendation: SSM-first.What worked out of the box ✅
AmazonSSMManagedInstanceCoreattached to the instance profile,describe-instance-informationshowedPingStatus=Onlineessentially as soon as the instance booted. No bootstrap needed for connectivity.AWS-RunPowerShellScript) works — ran PowerShell remotely, got stdout back (PSVersion, hostname,nt authority\system). This is the Windows equivalent ofconnect --command.connectViaSessionManager(already incmd/connect.go) usesaws ssm start-session, which is OS-agnostic and works on Windows today — no SSH, no inbound 3389.ec2:GetPasswordDatareturned the encrypted Administrator password blob (684 chars) ~immediately — the RDP credential path is viable (decrypt with the keypair private key).What's broken / Linux-shaped today ❌
buildUserData(cmd/launch.go:1966) unconditionally emits a#!/bin/bashscript. Windows EC2Launch only runs<powershell>/<script>-tagged user-data, so the bash spored-install is silently ignored. Theplatform.Detect()in launch is the client's OS (the laptop), not the target — there's no notion of target-instance OS. So a Windows launch today boots a bare instance with no spored at all → no TTL/idle/cost/completion enforcement (exactly the zombie risk; the reaper backstop is the only safety net, and it's account-wide tag-based so it does cover Windows).install-spored.sh+/tmp/SPAWN_COMPLETE. The Go logic ports, but every OS touchpoint (service mgmt, PowerShell user-data, CPU/process sampling, paths, completion file) needs a Windows impl, and it must ship as a Windows Service built forwindows/amd64.spawn-key-<user>). WindowsGetPasswordDatadecryption requires the RSA private key — if the user's key is ED25519, EC2 password decrypt won't work. spawn would need to ensure an RSA keypair for Windows launches and track the private key.Recommended phasing
--os windowsor detect from AMI platform). For Windows: skip the bash spored bootstrap, attachAmazonSSMManagedInstanceCore, routeconnect+connect --commandthrough SSM (start-session / RunCommand — already mostly present). Lifecycle = TTL/terminate via tags + the server-side reaper backstop (Server-side TTL reaper: out-of-band backstop so a spore can never outlive its deadline (even if spored is dead) #70), no in-instance agent yet. This alone gives launch + connect + bounded cost.sporedas a cross-platform binary with a Windows Service wrapper + PowerShell user-data; port idle/CPU/completion to Windows. Full parity (idle-stop, completion-file, pre-stop).GetPasswordData+ decrypt + emit.rdp), polish.Cross-cutting
Net: the connection story is largely already here (SSM). The real build is target-OS-aware launch (Phase 1) and spored-on-Windows (Phase 2).
scttfrdmn commentedon Jun 8, 2026
Phase 2 (spored on Windows) now tracked separately in #77. Phase 1 (target-OS-aware launch + SSM connect + TTL/reaper lifecycle) remains the prerequisite.
feat(keys): normalize SSH/EC2 keypair handling across AL2023, Ubuntu,…
feat(windows): target-OS-aware launch + Windows connect (#55 Phase 1) (…
scttfrdmn commentedon Jun 8, 2026
Phase 1 shipped in #82, released as v0.37.3.
spawn launchis target-OS-aware:--os windows|linuxor auto-detect via the AMI →spawn:ostag. Windows requires--ttl(no in-instance agent yet, Windows spored — cross-platform lifecycle agent as a Windows Service #77) and warns that the TTL deadline + reaper (Server-side TTL reaper: out-of-band backstop so a spore can never outlive its deadline (even if spored is dead) #70) are the only lifecycle enforcement.<powershell>block (OpenSSH + the spawn RSA key); no spored.spawn connecton Windows fetches+decrypts the Administrator password, prints RDP instructions, opens an SSM PowerShell session;connect -- <cmd>runs via SSM RunCommand.Verified end-to-end on real AWS (launch auto-detect/tag/key/warning; connect decrypted the live Administrator password + SSM; one-shot RunCommand; no-TTL guard; Linux regression).
Remaining for full Windows parity: #77 (spored on Windows → in-instance idle/completion/pre-stop). Phase 1 leaned on the reaper backstop deliberately. Optional polish:
.rdpfile emission + auto-launch mstsc.chore(release): v0.38.0 — Windows spored
scttfrdmn commentedon Oct 19, 2026
Exploration complete and both phases shipped: Phase 1 (target-OS-aware launch, SSM/RDP connect) in #82, released v0.37.3; Phase 2 (spored as a Windows service) is #77, closed as completed and released in v0.38.1.