Skip to content

SSM: Add Run Command operations (SendCommand, GetCommandInvocation, DescribeInstanceInformation) #258

Closed

Description

@scttfrdmn

Summary

The SSM plugin covers Parameter Store fully but is missing the Run Command API. This is the mechanism used to execute shell commands on EC2 instances remotely — a common pattern for post-launch configuration, health checks, and diagnostics.

Missing Operations

Operation Description
SendCommand Submit a command (document + parameters) to one or more instances
GetCommandInvocation Poll the status and output of a submitted command
DescribeInstanceInformation List instances with SSM agent registered

Expected Behavior

SendCommand

  • Accepts DocumentName (e.g. AWS-RunShellScript), InstanceIds, and Parameters (e.g. {"commands": ["echo hello"]})
  • Returns a CommandId (UUID)
  • Command transitions: Pending → InProgress → Success (or Failed)

GetCommandInvocation

  • Takes CommandId + InstanceId
  • Returns Status, StandardOutputContent, StandardErrorContent
  • In test mode, should immediately return Success with configurable output (or allow the test to pre-register expected outputs)

DescribeInstanceInformation

  • Returns instances that have SSM agent "registered"
  • In test mode, all running instances should appear as SSM-managed

Test Hooks

For deterministic testing it would be useful to pre-configure command responses:

ts.RegisterCommandResponse("AWS-RunShellScript", substrate.CommandResponse{
    Status: "Success",
    Stdout: "setup complete\n",
})

Motivation

Used extensively by Prism for:

  • Post-launch instance configuration (package install, service start)
  • File operations on remote instances (manager.go, pkg/aws/file_ops.go)
  • S3 backup coordination (pkg/aws/s3_backup.go)
  • Instance diagnostics and health checks

SendCommand + GetCommandInvocation appear at 8+ call sites in the Prism codebase.

Implementation Notes

Fits in ssm_plugin.go. The core is a command store (map of CommandId → invocation record) with immediate-success semantics in test mode. A pre-registration hook (similar to how mock HTTP servers work) would enable output-specific test assertions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions