Reputation: 715
Is there a way to auto-install AWS Systems Manager on the existing AWS EC2 instances.
I see the SSM agent is pre-install on Amazon Linux, but how about the other OS like Redhat, ubuntu, centos?
Upvotes: 2
Views: 4515
Reputation: 21
Work for RHEL 8.4 add:
Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
cloud_final_modules:
- [scripts-user, always]
--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"
#!/bin/bash
cd /tmp
sudo dnf install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
sudo systemctl enable amazon-ssm-agent
sudo systemctl start amazon-ssm-agent
--//--
Upvotes: 1
Reputation: 238051
how about the other OS like Redhat, ubuntu, centos?
Ubuntu also has pre-installed SSM Agent. From docs:
SM Agent is preinstalled, by default, on the following Amazon Machine Images (AMIs):
Amazon Linux
Amazon Linux 2
Ubuntu Server 16.04
Ubuntu Server 18.04
Amazon ECS-Optimized
For the remaining AMIs, you could install the agent as described in the docs and create a custom AMI. This way you do it only once, and re-use the custom AMIs.
As an alternative, a User Data could be used to automate the installation of the agent whenever an instance is launch.
Upvotes: 2