Systems Manager (SSM)

AWS Systems Manager (SSM)

Systems Manager can be used in conjunction with the EC2 Docker backend to run operational tasks on the Dockerised instances.

The following table highlights some differences between LocalStack SSM and AWS SSM.

LocalStackAWS
Instances are automatically registered with SSMInstances are manually registered using CreateActivation
Uses Docker exec to perform operationsUses Amazon SSM Agent
Instance IDs are prefixed with i-Instance IDs are prefixed with mi-

Following operations are currently supported:

OperationNotes
DescribeInstanceInformationList all registered instances
SendCommandCurrently only AWS-RunShellScript document is supported
ListCommandInvocationsList all invocations
GetCommandInvocationDetails of an invocation including standard output and standard error contents

Examples

  1. $ awslocal ssm send-command --document-name "AWS-RunShellScript" \
  2. --document-version "1" \
  3. --instance-ids i-04df0c15 \
  4. --parameters "commands='cat ./uptime',workingDirectory=/proc"
  5. {
  6. "Command": {
  7. "CommandId": "e53e67c3-a8f2-419e-87e4-e596880797e8",
  8. "DocumentName": "AWS-RunShellScript",
  9. "DocumentVersion": "1",
  10. "InstanceIds": [
  11. "i-04df0c15"
  12. ],
  13. "Status": "InProgress"
  14. }
  15. }
  16. $ awslocal ssm get-command-invocation \
  17. --command-id a0105ed1-0a4d-423b-9a64-9a49828f5391 \
  18. --instance-id i-04df0c15
  19. {
  20. "CommandId": "a0105ed1-0a4d-423b-9a64-9a49828f5391",
  21. "InstanceId": "i-04df0c15",
  22. "DocumentName": "AWS-RunShellScript",
  23. "DocumentVersion": "1",
  24. "Status": "Success",
  25. "StandardOutputContent": "1066081.29 510156.74\n",
  26. "StandardErrorContent": ""
  27. }

Limitations

  • Only AWS-RunShellScript is supported for Dockerised instances.
  • If the command returns a non-zero code, the standard output and standard error streams are not captured and will be empty.
  • Shell constructs like job controls (&&, ||), redirection (>) etc. are not supported.

Last modified March 9, 2022: add docs for AWS SSM and EC2 container integration (#117) (603dcbef)