This guide describes how to enable the Cmd agent on AWS SSM-managed servers.

This example uses an Amazon Linux 2 instance running SSM on AWS. These instructions also apply to most Debian variants using systemd.



First, install the Cmd agent to your target server images. 

Then, configure the SSM agent as follows:

SSM configuration script

This script changes the  /etc/systemd/system/amazon-ssm-agent.service  file*: 

  • Under the [Unit] directive, it adds the line:  After=cmd.service  

  • Under the [Service] directive, it adds the line:   

cp /etc/systemd/system/amazon-ssm-agent.service /etc/systemd/system/amazon-ssm-agent.service.orig
sed -i 's/\[Unit\]/\[Unit\]\nAfter=cmd.service/g' /etc/systemd/system/amazon-ssm-agent.service
sed -i 's/\[Service\]/\[Service\]\' /etc/systemd/system/amazon-ssm-agent.service
systemctl daemon-reload
systemctl restart amazon-ssm-agent.service

Within a couple minutes, your servers will appear at

* Note: If this file doesn't exist yet, you can make a copy of the default version with e.g.: cp /usr/lib/systemd/system/amazon-ssm-agent.service /etc/systemd/system/amazon-ssm-agent.service

Did this answer your question?