Installing and Configuring SSM Agent on Linux

1 hour
  • 6 Learning Objectives

About this Hands-on Lab

The Systems Manager Agent (SSM Agent) is at the heart of all the automation, management, and other tasks possible via Systems Manager. It must be installed on any machine managed by SSM. In this hands-on lab, we will manually install and configure SSM Agent on a Linux OS on an EC2 instance. We will then assign an appropriate SSM IAM role to our EC2 instance to be configured with Systems Manager. This lab assumes some knowledge of Linux — specifically, RHEL/CentOS package management and some general Linux skills.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Log in to the EC2 Instance via SSH

Log in to the EC2 instance provisioned for you by the lab:

ssh cloud_user<PUBLIC_IP_OF_EC2_INSTANCE>
Install the SSM Agent Using YUM

The EC2 instance in our case is a CentOS 7 system, so we will install the appropriate SSM Agent RPM binary on it with the following command. (Keep the cloud_user password handy.)

sudo yum -y localinstall amazon-ssm-agent.rpm

Even though the download URLs has ec2-downloads-windows, these are the correct URLs for Linux/CentOS.

Log in to the AWS Console and Create IAM SSM Role for EC2
  1. Log in to the AWS console using the credentials provided on the lab page.
  2. Head to IAM > Roles.
  3. Click Create role.
  4. Select EC2 as the service that will use this role.
  5. Click Next: Permissions.
  6. In the search bar, type "AmazonEC2RoleforSSM", select this role, and click Next: Tags.
  7. Leave tags as default, and click Next: Review.
  8. Assign your role a name such as "MyEC2SSMRole".
  9. Click Create role.
Attach IAM Role to EC2 Instance
  1. Head to the EC2 console and under Running Instances, look for the instance tagged (named) SSMInstallInstance.
    • This instance, which was provisioned by the lab, is the same one you logged into and installed SMS Agent on using YUM.
  2. Select this instance.
  3. Click the Actions dropdown.
  4. Scroll to Instance Settings.
  5. Click Attach/Replace IAM Role.
  6. From the dropdown, select your IAM role and then click Apply.
Log Back in to Command Line of EC2 Instance

Head back to the CLI of your EC2 instance that you installed SSM Agent on earlier. We will enable and start the SSM Agent so it can survive reboots and communicate with Systems Manager.

  1. Enable SSM Agent:

    sudo systemctl enable amazon-ssm-agent
  2. Start SSM Agent:

    sudo systemctl start amazon-ssm-agent
  3. To confirm the SSM Agent has started and is running successfully, check its status:

    sudo systemctl status amazon-ssm-agent

    The output should show an active/running status.

Check Logs for SSM Agent and Enable Debug Logging for It

Look at the SSM Agent log file, which houses all communication logs and actions that SSM Agent is performing on the instance:


The verbosity of SSM Agent logging can be increased by copying over and modifying a configuration file (/etc/amazon/ssm/seelog.xml.template) that comes by default with the SSM Agent install. To do so, carry out the following steps:

  1. Copy the example template to its original file name so it can be detected by SSM Agent:

    sudo cp /etc/amazon/ssm/seelog.xml.template /etc/amazon/ssm/seelog.xml
  2. Edit the file you just copied:

    sudo vim /etc/amazon/ssm/seelog.xml
  3. Look for this line in the file:

    <seelog type="adaptive" mininterval="2000000" maxinterval="100000000" critmsgcount="500" minlevel="info">

    Change minlevel="info" to minlevel="debug". Save and quit the file.

  4. Restart SSM Agent:

    sudo systemctl restart amazon-ssm-agent
  5. Tail the SSM Agent’s log file to observe the newly enabled verbosity (debug):

    sudo tail -f /var/log/amazon/ssm/amazon-ssm-agent.log

What are Hands-on Labs

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.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?