Welcome to another beginner-friendly guide on connecting to your EC2 instance using AWS Systems Manager (SSM). So say hello to hassle-free, secure connections with just a few simple steps!
Step 1: Create an IAM Role:
Search and navigate to the IAM (Identity and Access Management) dashboard in the AWS Management Console.
Select "Role" on the left hand side of your screen and click "Create role"
Create a new IAM role with the necessary permissions for EC2 following the screenshots below.
In the searchbox displayed on the next page, search for "managedinstance", select the result displayed and click next.
Name your IAM role accordingly. I named mine "EC2-SSM-MANAGED-INSTANCE-CORE", leave everything else as is and scroll down to click create role.
Step 2: Launch EC2 Instance:
Search for "EC2" in the search bar and click "instances".
Select "Launch instance" and follow the screenshots below.
Make sure to still select an existing keypair or create a new one because it's still needed.
You can also notice that in the screenshot above I am unticking the "Allow SSH traffic from" box.
Click on "Advanced details" tab and select the IAM role you created earlier in the "IAM instance profile" section below, click create instance and wait for your instance to launch.
Step 3: Connect to your EC2 Instance via SSM:
Once your instance in done creating, select it and click connect above.
Make sure to select "Session Manager" as the connection mode and click connect below.
After that, a terminal should pop up in a new tab on your browser which eliminates the need of having to ssh directly to your linux box and reduces security risks.
Please remember to delete the EC2 instance after use so as to not incure cost on your AWS account. Do not worry about the IAM ROLE created as this is free and can be used repeatedly
Top comments (0)