Skip to content

fix(spored): install AWS CLI before S3 download on Windows (#77) - #88

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/77-windows-awscli-bootstrap
Jun 9, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/77-windows-awscli-bootstrap

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Summary

Real-EC2 verification of v0.38.0 found the Windows bootstrap silently failed to install spored: the stock Windows Server 2022 AMI has no AWS CLI (unlike AL2023, where install-spored.sh relies on the preinstalled aws), so the aws s3 cp in buildWindowsUserData / install-spored.ps1 errored and spored was never downloaded. EC2Launch reported "script finished successfully" because the install ran in a try/catch with ErrorActionPreference=Continue.

Fix

Install AWS CLI v2 (official MSI) if aws.exe is absent, before the S3 download, and invoke it by full path ($ProgramFiles\Amazon\AWSCLIV2\aws.exe) since the session PATH won't include it yet. Applied to both the launch user-data and install-spored.ps1. Also fixes a Go raw-string build break (backticks in the msiexec args → -ArgumentList @('/i',$msi,'/qn')).

Validated on real Windows 11

  • The exact MSI-install command succeeds and yields a working aws.exe (aws-cli/2.34.64).
  • The generated user-data PowerShell parses cleanly.

The end-to-end EC2 flow (boot → CLI install → spored download → service → monitor → self-terminate) is re-verified after this merges into the next release.

Refs #77.

Real-EC2 verification of v0.38.0 revealed the Windows bootstrap silently failed
to install spored: the stock Windows Server 2022 AMI has NO AWS CLI (unlike
AL2023, where install-spored.sh relies on the preinstalled aws), so the
`aws s3 cp` in buildWindowsUserData / install-spored.ps1 errored out and spored
was never downloaded. EC2Launch reported "script finished successfully" because
the install was in a try/catch with ErrorActionPreference=Continue.

Fix: install AWS CLI v2 (the official MSI) if aws.exe is absent, before the S3
download, and invoke it by full path ($ProgramFiles\Amazon\AWSCLIV2\aws.exe)
since the current session PATH won't include it yet. Applied to both the
launch user-data and install-spored.ps1.

Validated on real Windows 11: the MSI install command succeeds and yields a
working aws.exe (aws-cli/2.34.64); the generated user-data PowerShell parses
cleanly. (Also fixes a Go raw-string build break from backticks in the msiexec
args — switched to the -ArgumentList @('/i',$msi,'/qn') array form.)

Refs #77.
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 877795e into main Jun 9, 2026
3 checks passed
@scttfrdmn
scttfrdmn deleted the fix/77-windows-awscli-bootstrap branch June 9, 2026 01:15
scttfrdmn added a commit that referenced this pull request Jun 9, 2026
Patch release for the two fixes that make Windows spored actually install and
self-manage on EC2 (found in v0.38.0 real-EC2 verification):
- #88: install the AWS CLI before the S3 download (stock Windows AMI has none).
- #89: attach SSM core to the spored instance role (Windows connect needs SSM).

Verified end-to-end on real Windows EC2: boot → CLI install → spored download
from S3 → Windows Service → reads config from tags → self-terminates at TTL.
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