Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Managing Infrastructure State with State Manager and Run Command

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.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 45m
Published
Clock icon Feb 07, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Log in and Head to AWS Systems Manager Console

    Log in to the AWS Management Console and head to AWS Systems Manager console.

  2. Challenge

    Check Managed Instance, Run Command, and State Manager Association

    Ensure that under the Fleet Manager page, you see that pre-configured SSM EC2 Linux instance.
    The Name tag of that instance is SSMInstance.

    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
  3. Challenge

    Auto update SSM agent

    Once you're on the Fleet Manager page, under The AWS Systems Manager console on AWS GUI.
    Click on the Account management button and choose Auto-update SSM agent button 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.
    Now head to State Manager from 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 Fleet Manager page your SSM agent version column will reflect the latest version your agent was updated to.

  4. Challenge

    Execute a Run Command Document

    On your AWS Systems Manager console, head towards the Run Command page from the SSM features navigation pane to the left.

    1. Click on Run Command button to the right top side of your screen, which will take you to the selection of Document to execute during Run Command.
    2. 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.
    3. Leave Document Version to default
    4. Leave command parameters to default as well(these parameters are basically input to the Run Command)
    5. Under Targets, select Choose instance manually. The SSMInstance should show up, select it.
    6. Leave Other Parameters and Rate Control to default and uncheck Enable writing to an S3 bucket option under Outputs.
    7. Leave everything else to default and click on Run.

    You'll be taken to the Run Command page with the details and progress of the Run Command that you just issued.

  5. Challenge

    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 Session and on the next page which loads, select your SSMInstance and click on Start Session again.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans