Run commands on EC2 instances via AWS Systems Manager
Build a workflow triggered with target instance IDs (or a tag filter) and the command to run. Invoke SSM SendCommand, poll the invocation until complete, and collect stdout/stderr per instance. Handle instances not managed by SSM, command timeouts, and partial failures, and require approval for sensitive commands. Output the per-instance command results.
What this prompt builds
Execute a command on EC2 instances through SSM Run Command and capture the output.
The problem
Running commands across EC2 fleets means SSHing into boxes or building bespoke tooling, which is slow and inconsistent and leaves no record. Ad-hoc access also widens risk.
Solution and impact
This workflow uses AWS Systems Manager Run Command to execute a command on target instances and returns the output to the workflow. Remote operations become agentless, auditable, and repeatable.