I hope everyone knows how to access an EC2 instance with a “keypair” and, lets see how we can access an EC2 instances with AWS Systems Manager, Session Manager option. This is really easy when you have access to the AWS console and, you don’t need to grab your keys and open up a ssh session using a client software. AWS itself provides a web console itself to access the running instances. By default all instances are not enabled with this service and, special roles and policies should be attached to the instances.
If you access the Session Manager under, Systems Manager you cannot see any instance in the console.

Read. More:
- How To Perform A Failover Test In MongoDB Atlas Cluster
- VMware Hands On Labs (HOL) And Tanzu Mission Control
- VMware Kubernetes Academy – A Free Education Platform
- How To Create A Multi-Node ECS Cluster And A Task Definition In AWS
Adding “AmazonEC2RoleforSSM” Policy
EC2 instances are normally allowing to access the AWS services using a role and, policies should be attached to the role. In order to enable the access to instances, “AmazonEC2RoleforSSM” should be attached.

If you don’t have a role created make sure to create a role with this policy attached.

After couple of minutes login to the AWS Systems Manager and, access the Session Manager. Instance will be listed and, select the instance and start the Session.

It will open up an another tab with a connection to the instance, you can now run the commands directly from the console. This session will be loaded with the “ssm-user” which is a part of “sudoers”. Here is my instance. output with few commands.

Session can be terminated with the “Terminate” button at the top. I hope, this is quite useful when need to access EC2 instances.
Rajitha Wijekoon
February 19, 2020Useful (Y) (Y)
Aruna Lakmal
February 22, 2020😊