

Modify your Security Group's Outbound Rules Sudo systemctl status amazon-ssm-agent If this command returns the message "amazon-ssm-agent is stopped", run and then try this command againģ. To verify that the Agent is up and running.
#Ssm session manager install#
Sudo yum install -y Replace with the AWS region in which your Ec2 instance is deployed. SSM Agent is installed by default on most amazon-linux AMIs however, if you need to install it, use this command.Once inside, proceed with the steps below. SSH into your instance using the preferred method you have already configured, or use the Ec2 instance connect service on the AWS console. SSM Agent version 2.3.68.0 or later must be installed on the Ec2 instance that we want to log in to using Session Manager. Verify SSM Agent is running on your Instance The AmazonSSMManagedInstanceCore policy enables the instance to use the AWS Systems Manager service core functionality. This provides permissions for communication between the instance and the Systems Manager API. Create and attach the necessary EC2 Instance RoleĬreate an IAM role with the policy AmazonSSMManagedInstanceCore and attach the role to your Ec2 instance.
#Ssm session manager how to#
If you don't, click " here" to learn how to do so.


This article assumes you already have a similar instance running with an open inbound port 22. Please keep in mind that the steps below describe how to connect to an amazon-linux-2 EC2 instance using a session. Among its many capabilities, SSM Session Manager provides secure and auditable node management without the need to open inbound ports, maintain Bastion Hosts, or manage SSH keys, by using the console or the AWS CLI. How to Connect to Amazon EC2 Using AWS SSM Session ManagerĪWS Systems Manager (SSM) is a service that you can use to view or control deployed infrastructure in your account. However, after extensive use, or in my case, stumbling across online reports like "Hackers hijacked my account to mine Bitcoin, resulting in a $40,000 monthly bill," one may consider the effort of handling private keys and leaving inbound port 22 open on one's security group to be unnecessarily risky. This is because SSH provides a cryptographically secure connection that allows a user to authenticate, execute commands, and relay input/output from and to a remote server over an unsecured network (The Internet).įor many new AWS users, SSH is the preferred method of accessing instances on compute services such as EC2 or Lightsail. Secure Shell protocol (SSH) is one of the most common ways to safely administer a remote server across many platforms, using the standard TCP port 22.
