# 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).

Screenshot: Run Command result: df -h succeeded on web-1 and checkout-api-1, with each instance's exit code and output

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

| What | IAM actions | In ReadOnlyAccess / ViewOnlyAccess |
|---|---|---|
| Managed instances | `ssm:DescribeInstanceInformation` (and `ec2:DescribeInstances` for the unmanaged list) | Yes / No (add it) |
| Recent commands, status and output | `ssm:ListCommands`, `ssm:ListCommandInvocations`, `ssm:GetCommandInvocation` | Yes / No (add them) |
| Run | `ssm:SendCommand` on the document and the instances | No / 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 [support@cloudconsole.dev](mailto:support@cloudconsole.dev) with what you tried and any message the app showed. Don’t send access keys or secrets. We reply within two working days.

## Related

- [Parameter Store: browse, reveal and edit parameters](https://cloudconsole.dev/help/parameter-store) – Using the app
- [What you can change from your phone](https://cloudconsole.dev/help/actions) – Safety & changes
- [Permissions for changes (Pro actions)](https://cloudconsole.dev/help/permissions-for-changes) – Permissions & errors
- [Guardrails: how changes are confirmed](https://cloudconsole.dev/help/guardrails) – Safety & changes

[All help topics →](https://cloudconsole.dev/help/)

---

Source: https://cloudconsole.dev/help/run-command

CloudConsole is an independent iPhone and Android app for Amazon Web Services by Cloudconcur Ltd. It is not affiliated with Amazon Web Services.
