EC2 Run Command (Shell)

Overview

The EC2 Run Command (RunShellScript) action runs a shellscript on targeted EC2 instances.

This allows you to remotely execute shellscripts for efficient administration and operations of your Unix/Linux-based infrastructure, including automating system tasks, troubleshooting problems, deploying applications and managing security patch updates on EC2 instances.

This action is designed for use with Unix/Linux-based EC2 instances only. To run a PowerShell Script on Windows-based instances, use the EC2 Run Command (RunPowerShellScript) action instead.

How it works

The EC2 Run Command (RunShellScript) action uses these endpoints to target EC2 instances and execute a Shell script from them using Systems Manager:

Before you can use the EC2 Run Command (RunShellScript) action, your EC2 instance must be ready to use with AWS Systems Manager.

The first step is to install the SSM Agent on your EC2 instance, unless your EC2 instance was based on an AMI that came with the SSM Agent pre-installed.

The second step is to provide AWS Systems Manager with the necessary permissions to send shellscripts to your targeted EC2 Instances.

We do not advise manually modifying the permissions attached to the cross-account role that is created by GorillaStack in AWS. GorillaStack updates this role with your permission when you change your account preferences, and this may cause any manual changes to be lost. Instead, follow the instructions provided in the AWS docs under “To create an instance profile for Systems Manager managed instances (console)”.