DEV Community

Khang Tran
Khang Tran

Posted on

1

How to Connect to an EC2 Instance with SSM

  1. Launch an EC2 instance. (Preferably with an AMI using Amazon Linux 2023 or later)

  2. Create an IAM role, and attach the policy "AmazonSSMManagedInstanceCore"

  3. Attach the role to your EC2 instance

  4. Go to your instance, click "connect" and choose "Session Manager"

The benefits of connecting to your EC2 instance through Session Manager is that doesn't require you to open any ports to connect. This reduces the attack surface of your systems providing more security to your network.

Tip: After you created your EC2 instance, you can check if it has the SSM agent installed by connecting with Direct Connect first and then running the command

sudo systemctl status amazon-ssm-agent
Enter fullscreen mode Exit fullscreen mode

You should get an output like this

Direct Connect Output

Top comments (0)

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay