Run Command and State Manager are two core features of the SSM service. They enable users to administer managed hybrid infrastructure remotely as well as maintain persistent configurations on instances on a schedule. Both of these features are used heavily during basic SSM tasks such as Session Manager sessions (Run Command) and querying and maintaining systems inventory (via State Manager associations).
These features can be extremely handy when remotely managing a ton of systems spread across different cloud providers and on-prem datacenter.
State Manager Associations can prove useful in enforcing a fixed configuration across your fleet of instances thereby reducing their drift from standard configuration over time.
Successfully complete this lab by achieving the following learning objectives:
- Log in and Head to AWS Systems Manager Console
Log in to the AWS Management Console and head to AWS Systems Manager console.
- Check Managed Instance, Run Command, and State Manager Association
Ensure that under the Managed Instances page, you see that pre-configured SSM EC2 Linux instance.<br/>
Nametag of that instance is
This instance has been set up by the lab environment for you and we’ll be performing some Run Command and State Manager association tasks on it, such as:
- Auto-updating the SSM Agent (which establishes and runs a State Manager association)
- Using a Run Command to configure and install Docker on the SSM EC2 instance
- Auto update SSM agent
Once you’re on the
Managed Instancespage, under The AWS Systems Manager console on AWS GUI.
Click on the
Agent auto updatebutton at the top of the Managed instance selection area.
This basically, sets up a persistent SSM State Manager association which periodically checks your managed instances for older versions of SSM agent and updates it.
Once you click the button you’ll be given a prompt with description of what the SSM service will do, go ahead and click on
Auto update SSM agent.<br/>
Now head to
State Managerfrom the SSM features navigation pane on left hand side to track the progress of the association which will help update your SSM agent(s).
After it completes successfully, you’ll note that on the
Managed Instancespage your SSM agent version column will reflect the latest version your agent was updated to.
- Execute a Run Command Document
On your AWS Systems Manager console, head towards the
Run Commandpage from the SSM features navigation pane to the left. <br/>
- Click on
Run Commandbutton to the right top side of your screen, which will take you to the selection of Document to execute during Run Command.
- Choose the Document
AWS-ConfigureDocker(click on the radio button next to it), alternatively you can also click on the search bar which will give a drop down for narrowing search against specific OS, Document types etc. So if the
AWS-ConfigureDockerdocument is not showing in the default shown documents, click on the search bar, select
Platform typesand select
Linuxwhich should provide this document in the top few search results.
Document Versionto default
- Leave command parameters to default as well(these parameters are basically input to the Run Command)
Choose instance manually. The
SSMInstanceshould show up, select it.
Rate Controlto default and uncheck
Enable writing to an S3 bucketoption under
- Leave everything else to default and click on
You’ll be taken to the
Run Commandpage with the details and progress of the Run Command that you just issued.
- Click on
- Verify Run Command
You can verify that Run Command was run successfully either by logging into the EC2 instance via SSH or Session Manager session and issuing commands such as:
systemctl status docker #to check it it's running docker ps
Remember that the objective of this lab is to verify installation not the functionality and docker commands, if the docker daemon is not running you can start it with:
sudo service docker status
For logging in via Session Manager, head to Session Manager page from the AWS Systems Manager console, click on
Start Sessionand on the next page which loads, select your
SSMInstanceand click on