
Systems Manger Run Command can be used to, as the name suggests, run a command on a target system. For example, you could run a command on an EC2 instance using
- Ansible
- Bash Shell Script
- Chef
- PowerShell
- Python
Let's run a Bash Shell Script on an EC2 instance.
In the left panel of the AWS Systems Manager console, select Run Command.
And let's select AWS-RunShellScript.
In the Command parameters, let's run a command. In this example, "Hello World" will be written to /tmp/hello.txt.
Since this is meant to be just a simple Getting Started article, let's select one EC2 instance. If you see No registered managed instances, check out my article FreeKB - Amazon Web Services (AWS) - Resolve "No registered managed instances".
Select Run. And if all goes well, Success should be displayed.
And on the EC2 instance, I verified that /tmp/hello.txt existed and did contain Hello World. Nice.
[ec2-user@ip-172-31-86-107 ~]$ cat /tmp/hello.txt
Hello World
It is noteworthy that /tmp/hello.txt was owned by root:root, so that's something to keep in mind here.
[ec2-user@ip-172-31-86-107 ~]$ ls -l /tmp/hello.txt
-rw-r--r--. 1 root root 12 May 28 09:32 /tmp/hello.txt
Did you find this article helpful?
If so, consider buying me a coffee over at