3 Ways to Connect and SSH into an EC2 Instance – AWS

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

3 Ways to Connect and SSH into an EC2 Instance – AWS. In this guide you are going to learn how to connect to your EC2 instance from your local Linux or Mac or from your Windows machine.

3 Ways to Connect and SSH into an EC2 Instance

  1. Connect using a standalone SSH client.
  2. Connect using Session Manager.
  3. Connect using browser-based SSH connection.


  1. A running EC2 Instance. Learn how to create an AWS EC2 instance.
  2. Assigned a Elastic IP to your EC2 Instance.
  3. Pem key file downloaded when you have created your EC2 Instance.
  4. If you are on Windows and try the standalone method, you need PUTTY SSH client to connect to your Instance.

Before you connect to your EC2 instance make sure your IP address is added in the Firewall to allow connections from your IP address or your instance allows connection from anywhere.

Configure Security rules

Connect using browser-based SSH connection

This is the easiest way to connect yo your Instance instantly. This method don’t require any additional clients installed in your local machine. To use this method,

Select your Instance and click the Connect button in your EC2 Dashboard.

Browser Based SSH Connection

In the Connection method choose EC2 Instance Connect.

The username of the AMI will get populated automatically.

Now click Connect.

Now a new window will get opened and a connection will get established to your Instance.

If you get any errors you need to wait for sometime once your instance is created.

Connect to EC2 Instance from Linux/Mac machines

From your Linux/Mac machine you can simply open your terminal window, use the ssh command to connect to the instance. You specify the private key (.pem) file, the user name for your AMI (in this case it is ubuntu), and the public DNS name for your instance or your Elastic IP address.

The connection string looks similar to the one below.

ssh -i "cloudbooklet.pem"

Connect to EC2 Instance from Windows using PUTTY

To SSH to your instance you need to convert your private key (.pem) file using PUTTYgen to ppk format.

Open PUTTYgen and Click Load.

Convert private key to PPK

Select the pem key you have downloaded while created your instance.

Once the file is imported, click Save private key to convert it to ppk format.

Save the file.

Launch PUTTY.

Connect using PUTTY

In Hostname/IP address enter DNS name or Elastic IP address.

In Port enter default 22.

In the left menu under Connection expand SSH and click Auth.

Browse and select the PPK file you just converted using PUTTYgen.

Now click Open.

This will create an SSH connection to your EC2 Instance.

Become a Certified AWS Professional with this easy to learn course now.


Now you have learned how to connect to your EC2 instance in AWS using standalone method or browser connection..

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

1 Comment

  1. I’m enter the ssh -i but response is not file directly….how to clear this…!?

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.