Installing the SSM agent

As discussed at the beginning of the chapter, the Systems Manager or the SSM agent is a vital piece of software that needs to be installed and configured on your EC2 instances in order for Systems Manager to manage it. At the time of writing, SSM agent is supported on the following sets of operating systems:

  • Windows:
    • Windows Server 2003 (including R2)
    • Windows Server 2008 (including R2)
    • Windows Server 2012 (including R2)
    • Windows Server 2016
  • Linux (64-bit and 32-bit):
    • Amazon Linux 2014.09, 2014.03 or later
    • Ubuntu Server 16.04 LTS, 14.04 LTS, or 12.04 LTS
    • Red Hat Enterprise Linux (RHEL) 6.5 or later
    • CentOS 6.3 or later
  • Linux (64-bit only):
    • Amazon Linux 2015.09, 2015.03 or later
    • Red Hat Enterprise Linux 7.x or later
    • CentOS 7.1 or later
    • SUSE Linux Enterprise Server 12 or higher

To install the agent on a brand new instance, such as the one we will create shortly, you simply need to ensure that the instance is provided with the necessary SSM IAM role that we created in the previous section, as well as to provide the following code snippet in the User data section of your instance's configuration:

#!/bin/bash 
cd /tmp                
wget https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_amd64/amazon-ssm-agent.deb 
sudo dpkg -i amazon-ssm-agent.deb 
sudo start amazon-ssm-agent 
The user data script varies from OS to OS. In my case, the script is intended to run on an Ubuntu Server 14.04 LTS (HVM) instance. You can check your SSM agent install script at http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-install-ssm-agent.html#sysman-install-startup-linux.

Once the instance is up and running, SSH into the instance and verify whether your SSM agent is up and running or not using the following command. Remember, the following command will also vary based on the operating system that you select at launch time:

# sudo status amazon-ssm-agent 

You should see the agent running, as shown in the following screenshot:

You can, optionally, even install the agent on an existing running EC2 instance by completing the following set of commands.

For an instance running on the Ubuntu 16.04 LTS operating system, we first create a temporary directory to house the SSM agent installer:

# mkdir /tmp/ssm 

Next, download the operating-specific SSM agent installer using the wget utility:

# wget https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_amd64/amazon-ssm-agent.deb 

Finally, execute the installer using the following command:

# sudo dpkg -i amazon-ssm-agent.deb 

You can additionally verify the agent's execution by tailing either of these log files as well:

# sudo tail -f /var/log/amazon/ssm/amazon-ssm-agent.log  
# sudo tail -f /var/log/amazon/ssm/errors.log 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset