Repository navigation
Closed
Description
Goal
Port the spored lifecycle agent to Windows so Windows instances get the same in-instance enforcement Linux gets today (TTL / idle / cost / completion-file / pre-stop). This is Phase 2 of the Windows path scoped in #55 (Phase 1 = target-OS-aware launch + SSM connect + TTL/reaper lifecycle, no agent).
Confirmed by the #55 spike: a Windows instance today boots with no spored at all (buildUserData only emits #!/bin/bash, which Windows EC2Launch ignores), so the only lifecycle safety net is the server-side reaper (#70). That's a backstop, not parity.
What's needed
Build / packaging
- spored compiled for
windows/amd64(the Go logic is already cross-platform; the OS touchpoints are not). - Installed as a Windows Service (or scheduled task), started at boot via PowerShell user-data (
<powershell>...</powershell>), not the bashinstall-spored.sh. Pull the binary from the S3 release bucket like Linux does.
OS touchpoints to port (Linux-specific today)
- Service management: systemd → Windows Service control.
- CPU / process sampling for idle detection (
/proc-based today) → Windows perf counters / WMI. - Completion-file watch:
/tmp/SPAWN_COMPLETE→ a Windows path (e.g.C:\spawn\SPAWN_COMPLETE); make the path OS-aware, not hardcoded. - pre-stop hook:
sh -c→ PowerShell. - Paths, logging location, the self-terminate/stop EC2 calls (these port directly — same SDK).
- Graceful shutdown on stop/terminate (Linux uses acpid; Windows has its own service-stop signal).
Launch integration (depends on #55 Phase 1)
- Target-OS-aware
buildUserData: emit PowerShell bootstrap for Windows instead of bash. - The release workflow already builds for multiple arch; add a
spored.exe(windows/amd64) artifact + S3 upload.
Dependencies / related
- [exploration] Windows AMI support — what's needed for connection & monitoring? #55 — Windows AMI exploration (Phase 1 must land first: OS-aware launch).
- Server-side TTL reaper: out-of-band backstop so a spore can never outlive its deadline (even if spored is dead) #70 — server-side reaper is the interim safety net until this exists.
- Key normalization (separate issue) — RSA keys for RDP password decrypt; not strictly required for spored itself.
Acceptance
- A Windows instance launched by spawn runs spored as a service, enforces TTL/idle/completion/pre-stop in-instance, and self-terminates like Linux — no longer dependent solely on the reaper backstop.
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat(keys): normalize SSH/EC2 keypair handling across AL2023, Ubuntu,…
feat(windows): target-OS-aware launch + Windows connect (#55 Phase 1) (…
refactor(spored): extract OS-specific surface behind build tags (#77 …
feat(spored): Windows idle/metrics via PowerShell/quser (#77 stage 2) (…
feat(spored): run as a native Windows Service (#77 stage 3) (#86)
feat(spored): ship Windows spored via S3 + install at launch (#77 sta…
chore(release): v0.38.0 — Windows spored
fix(spored): install AWS CLI before S3 download on Windows (#77) (#88)
fix(iam): attach SSM core to the spored instance role (#77) (#89)
scttfrdmn commentedon Jun 9, 2026
✅ Windows spored complete — verified end-to-end on real Windows EC2 (v0.38.1)
spored now runs on Windows as a native Windows Service with full lifecycle parity, deployed via S3 exactly like Linux.
Shipped across 5 PRs:
Real Windows EC2 verification (v0.38.1): launch → EC2Launch user-data installs AWS CLI → downloads spored.exe from regional S3 → installs + starts the Windows Service → spored runs as the EC2 provider → reads its config from EC2 tags (
Config: TTL=15m0s) → registers DNS → monitor loop runs → self-terminates at the TTL deadline. Zero leaks.The
--ttl-required Phase 1 guard is relaxed:--idle-timeoutis accepted now that idle works in-instance.Deferred (non-lifecycle-critical): the optional observability metrics collector (
pkg/agent/metrics.go) still reads /proc and degrades gracefully on Windows; a few/var/lib/sporedruntime paths (push token, plugin state, queue) are Unix-shaped on Windows but non-fatal (optional features). Both can be follow-ups.Closes the "no in-instance agent on Windows" caveat from #55.
feat(image): spawn image import — Windows ISO→AMI via EC2 Image Build…