DEV Community

Ajao Adedamola
Ajao Adedamola

Posted on • Updated on

Beginner's Guide: Connecting to Your EC2 Instance Using AWS Systems Manager (SSM)

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.

Image description

Select "Role" on the left hand side of your screen and click "Create role"

Image description

Create a new IAM role with the necessary permissions for EC2 following the screenshots below.

Image description

Image description

In the searchbox displayed on the next page, search for "managedinstance", select the result displayed and click next.

Image description

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.

Image description

Step 2: Launch EC2 Instance:

Search for "EC2" in the search bar and click "instances".

Image description

Select "Launch instance" and follow the screenshots below.

Image description

Image description

Image description

Image description

Make sure to still select an existing keypair or create a new one because it's still needed.

Image description

You can also notice that in the screenshot above I am unticking the "Allow SSH traffic from" box.

Image description

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.

Image description

Step 3: Connect to your EC2 Instance via SSM:

Once your instance in done creating, select it and click connect above.

Image description

Make sure to select "Session Manager" as the connection mode and click connect below.

Image description

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.

Image description

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)