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

Installing and Configuring SSM Agent on Linux

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.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
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 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>
    
  2. Challenge

    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.)

    wget https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
    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.

  3. Challenge

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

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

    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.

  6. Challenge

    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:

    /var/log/amazon/ssm/amazon-ssm-agent.log
    

    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
      

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