How to Connect to an EC2 Instance with SSM

Launch an EC2 instance. (Preferably with an AMI using Amazon Linux 2023 or later)
Create an IAM role, and attach the policy “AmazonSSMManagedInstanceCore”
Attach the role to your EC2 instance
Go to your instance, click “connect” and choose “Session Ma…


This content originally appeared on DEV Community and was authored by Andy Tran

  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

You should get an output like this

Direct Connect Output


This content originally appeared on DEV Community and was authored by Andy Tran


Print Share Comment Cite Upload Translate Updates
APA

Andy Tran | Sciencx (2024-08-30T21:41:18+00:00) How to Connect to an EC2 Instance with SSM. Retrieved from https://www.scien.cx/2024/08/30/how-to-connect-to-an-ec2-instance-with-ssm/

MLA
" » How to Connect to an EC2 Instance with SSM." Andy Tran | Sciencx - Friday August 30, 2024, https://www.scien.cx/2024/08/30/how-to-connect-to-an-ec2-instance-with-ssm/
HARVARD
Andy Tran | Sciencx Friday August 30, 2024 » How to Connect to an EC2 Instance with SSM., viewed ,<https://www.scien.cx/2024/08/30/how-to-connect-to-an-ec2-instance-with-ssm/>
VANCOUVER
Andy Tran | Sciencx - » How to Connect to an EC2 Instance with SSM. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/30/how-to-connect-to-an-ec2-instance-with-ssm/
CHICAGO
" » How to Connect to an EC2 Instance with SSM." Andy Tran | Sciencx - Accessed . https://www.scien.cx/2024/08/30/how-to-connect-to-an-ec2-instance-with-ssm/
IEEE
" » How to Connect to an EC2 Instance with SSM." Andy Tran | Sciencx [Online]. Available: https://www.scien.cx/2024/08/30/how-to-connect-to-an-ec2-instance-with-ssm/. [Accessed: ]
rf:citation
» How to Connect to an EC2 Instance with SSM | Andy Tran | Sciencx | https://www.scien.cx/2024/08/30/how-to-connect-to-an-ec2-instance-with-ssm/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.