How to login to RHEL EC2 using Session Manager

Опубликовано: 27 Октябрь 2024
на канале: Unus AWS
300
5

This video shows the session manager setup for an RHEL EC2. To login to RHEL machine using session manager, you need to meet these 3 criteria.

1. The EC2 must be assigned an instance profile (role) which provides SSM access to the EC2. You can attach policy 'AmazonSSMManagedInstanceCore' to the role.

2. You should install SSM-agent in your machine.
dnf update -y
dnf install -y https://s3.amazonaws.com/ec2-download...

3. Ensure that your EC2's security group allows outbound https traffic. Usually this is allowed by default for any new sec grp.

You can ensure the first 2 conditions are met. Session Manager will work at this point. If it does not, then check condition number 3.

User Data:
Now, if you want to install ssm-agent when you launch the EC2, then include the below script in user data.

RHEL:
#!/bin/bash
dnf update -y
dnf install -y https://s3.amazonaws.com/ec2-download...

Ubuntu:
#!/bin/bash
apt update -y
snap switch --channel=candidate amazon-ssm-agent
systemctl start snap.amazon-ssm-agent.amazon-ssm-agent.service