SSH into Private EC2 Instance: AWS Session Manager Guide


Welcome to our guide on “SSH into Private EC2 Instance: AWS Session Manager Guide.” If you’re struggling to securely access your EC2 instances in a private subnet, this article is for you. We’ll walk you through the simple steps of using AWS Session Manager, a tool that makes SSH access seamless and secure, without the need for public IP addresses or intricate network setups. Whether you’re new to AWS or an experienced user, our straightforward guide will help you to SSH into private EC2 instances in no time. Let’s dive in!


As you can see in the below image we have an EC2 instance in private subnet. Also you can see it does not have any public IP using which we can SSH.

So to SSH into a private EC2 instance, we will have to configure AWS Session Manager. You can learn more about session manager from this AWS Blog.

AWS Session Manager Configuration

  1. Open the EC2 console and select the instance you want to SSH to.
  2. Click the connect button in the top right
  3. Select session manager. You will see a warning something like:
    How to SSH into private EC2 instance, initial screen of how Session Manager looks
  4. Click the button to Open Systems Manager Quick Setup
  5. Now you are in the Session Manager console.
    Here keep everything as it is, only change the target configuration.
    Choose account as current account and current region(or another region if your EC2 instance is in some other region). And then choose manual targets. Then choose your desired private EC2 instance.
    Configuration will look like the following.
    AWS Session manager configuration image
  6. Click create. And wait till all (5) steps are completed.
  7. Now go back to the EC2 console, select your private instance go to Connect and then Session Manager. You will see that earlier warning is gone and now the Connect button is enabled.
    AWS Session Manager enabled image
  8. Now Click Connect and you are now able to SSH.


In conclusion, accessing a private EC2 instance using AWS Session Manager is a secure and straightforward process. By eliminating the need for bastion hosts and complex network configurations, AWS Session Manager provides a hassle-free method to SSH into your private instances. This not only enhances security but also simplifies management tasks. Remember, the key is in the setup – ensuring your EC2 instances have the right IAM roles and SSM agents. Once everything is in place, you’re just a few clicks away from securely managing your AWS resources. So, embrace AWS Session Manager for a simpler, more secure approach to handling your EC2 instances.

Generally you face these types of scenarios where you have to SSH into private EC2 instance like when you are using a NAT Gateway. You can learn more about how to use and setup NAT Gateway from our other blog here.


No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *