How do I install Systems Manager Agent (SSM Agent) on an Amazon EC2 Linux instance at launch?
Last updated: 2019-04-15
How do I install AWS Systems Manager Agent (SSM Agent) on an Amazon Elastic Compute Cloud (Amazon EC2) Linux instance at launch?
You can install SSM Agent by adding user data to an Amazon EC2 Linux instance before the launch. SSM Agent is installed by default on Amazon Linux base AMIs dated 2017.09 or later. However, you must manually install SSM Agent on Amazon EC2 instances created from other versions of Linux AMIs.
1. Follow steps 1 through 5 at Launch an Instance Using the Launch Instance Wizard.
2. On the Configure Instance Details page, expand Advanced Details.
3. For User data, choose As text. In the User data box, type information according to your Linux distribution requirements.
For RHEL7 and Amazon Linux 2:
#!/bin/bash cd /tmp sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm sudo systemctl start amazon-ssm-agent
For Amazon Linux:
#!/bin/bash cd /tmp sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm sudo start amazon-ssm-agent
For more information, see User Data and the Console.
4. Finish adding other parameters, such as storage, tags, security group, and so on.
5. Launch your instance.