CloudConsole

Run Command: run a shell command on your instances

Run df -h, free -m or any command on managed EC2 instances through Systems Manager, follow it live and read the output.

Open Services → Systems Manager → Run Command, or an EC2 instance's More → Run command (it's picked for you).

Run Command result: df -h succeeded on web-1 and checkout-api-1, with each instance's exit code and output
Output per instance
  1. Pick instances. The list shows each managed instance's ping status, platform and SSM agent version. Instances whose agent isn't connected can't be picked.
  2. Type the commands, one per line, or tap a snippet: Disk (df -h), Memory (free -m), Uptime, Service status (systemctl status <service>: replace the placeholder), top processes, recent errors. Windows instances get PowerShell snippets and AWS-RunPowerShellScript; Linux ones AWS-RunShellScript.
  3. Run. It's a Pro action and goes through your guardrail. On an account whose name looks like production (prod, production, live), you always type the account name to confirm.

The command's screen updates every few seconds until every instance has finished, then shows each one's exit code, output and errors. The API keeps the first 24,000 characters of each; for more, the command needs an S3 bucket or CloudWatch Logs output, which the screen links to when set. Recent commands lists the last ones, with their results.

Instances that aren't managed

Running EC2 instances missing from Systems Manager are listed with the likely reason: No instance profile (attach a role with AmazonSSMManagedInstanceCore) or SSM agent not connected (the role lacks that policy, the agent is stopped, or the instance can't reach the SSM endpoints through the internet or VPC endpoints).

Permissions

WhatIAM actionsIn ReadOnlyAccess / ViewOnlyAccess
Managed instancesssm:DescribeInstanceInformation (and ec2:DescribeInstances for the unmanaged list)Yes / No (add it)
Recent commands, status and outputssm:ListCommands, ssm:ListCommandInvocations, ssm:GetCommandInvocationYes / No (add them)
Runssm:SendCommand on the document and the instancesNo / No

Questions

Does it open a shell session?

No. Run Command sends the commands and returns their output; nothing stays open. For an interactive session use Copy SSM session command on the instance and run it on your computer.

Still stuck?

Email [email protected] with what you tried and any message the app showed. Don’t send access keys or secrets. We reply within two working days.