Connect to your Amazon EC2 instance using Session Manager

Connect to your Amazon EC2 instance using Session Manager

You might encounter problems when you connect to the EC2 instance through the session manager for the first time. However, the following simple configuration can ensure a smooth process.

  • Create an IAM Role and attach the policy "AmazonSSMManagedInstanceCore

Article content
IAM Policy

  • Create a custom Security Group which allows outbound HTTPS connection to the following endpoints.

ec2messages.region.amazonaws.com

ssm.region.amazonaws.com

ssmmessages.region.amazonaws.com

  • Create an EC2 instance by clicking on Launch Instance

Article content
launch instance


  • Place your ec2 instance in a public subnet which contains a route pointing to an Internet Gateway object
  • Enable Public IP for the instance.
  • Attach the custom SG created on step2

Article content
Network settings


  • In the advanced section, select the IAM Instance profile created in step 1

Article content
Instance profile

  • Launch instance

Well, it's not over yet. If you see the connect icon under session manager greyed out, check the following items.

  1. SSM Agent not online

Reason: EC2 instance is not in a public subnet or does not have a route to the internet, or no Public IP is associated with the instance


Article content
error_1

2. Instance is not connected to the systems manager

Reason: Security Group does not have an outbound HTTPS rule enabled


Article content
error_2

Once these are sorted out, the connect icon becomes available.


Article content
SSM

The web shell would look like the one below.

Article content
shell

Also, you will see the SSM agent status under the Fleet Manager.

Article content
Managed nodes

In this way, Session Manager can be used to start a session with an instance in your account. After the session is started, you can run interactive commands on the instance as you would for any other connection type.

Resources:




To view or add a comment, sign in

More articles by Anoop Jayadharan

  • 🚦 BIG-IP APM API protection with Postman as OAuth Client

    This article describes how to configure an API protection proxy service on the BIG-IP APM as an OAuth resource server…

    1 Comment
  • A Website or Blog-page for you

    Here is how I developed and hosted my blog page on GitHub Pages for free. Prerequisites Install Git on your local…

  • Kerberos SSO constrained delegation with BIG-IP APM

    The primary purpose of Kerberos Single Sign-On is to provide seamless authentication to web or application servers once…

  • Database Migration

    If you need some background, visit my previous post, Launching MVP. The following diagram depicts the v1.

    6 Comments
  • CloudTalents Application on K8s🔥

    After building the docker image in the previous article, it's time to orchestrate containers using K8s. Follow along by…

    6 Comments
  • Dockerizing Cloudtalents Startup App

    All right, here you go; this is the high-level overview of the application. It is written in Python and uses the Django…

    1 Comment
  • Launching MVP

    The diagram depicts two CI/CD workflows. One builds the AMI using Packer, and the other deploys an EC2 from the custom…

    6 Comments
  • Building the Connectivity

    In one of the posts, I talk about setting up an AWS landing zone using the control tower. Followed these steps from the…

  • A Taste of DevOps

    A workflow is triggered when a developer pushes code to the main branch. The workflow has three jobs defined: Provision…

  • OIDC Integration between GitHub and AWS

    Does your GitHub Actions CI/CD pipeline have hard-coded, long-lived cloud-provider credentials for communicating with…

Explore content categories