Install SSM Agent on Ubuntu AWS EC2 Instance
Categories:
2 minute read
SSM agent is installed by default on the latest Ubuntu images, so first verify whether the SSM agent is already installed by executing the following command.
sudo snap list amazon-ssm-agent
if the above command returns error: no matching snaps installed
then proceed with installing the SSM agent.
Pre-requisite
Attach the following IAM policies to the IAM role assigned to the EC2 instance.
- AmazonSSMManagedInstanceCore - For SSM agent connectivity
- CloudWatchAgentServerPolicy - For cloudwatch agent
Manual installation
Execute the following commands in the EC2 instance to install SSM agent
sudo snap install amazon-ssm-agent --classic
Post install verification steps
Make sure SSM agent installed properly by running
sudo snap list amazon-ssm-agent
To check the status of the agent.
sudo snap services amazon-ssm-agent
Start the service manually if the previous command returned amazon-ssm-agent is stopped, inactive, or disabled.
sudo snap start amazon-ssm-agent
Enable AWS System manager Quick Setup (Optional)
Do the following optional steps to keep the SSM agent up to date.
- Open AWS Systems Manager console https://console.aws.amazon.com/systems-manager/home
- Click Quick Setup in the left navigation
- If this is first time you are using this then select the region and click Get started
- Click Create under the Host Management
- Select the the required checkboxes under Systems Manager
- Select the required region and instance options
- Click Create
Troubleshoot SSM Manager connectivity
- https://aws.amazon.com/premiumsupport/knowledge-center/systems-manager-ec2-instance-not-appear/
- https://aws.amazon.com/premiumsupport/knowledge-center/ssm-agent-logs/