How to access AWS EC2 instance with SSH using Powershell from Windows OS.

Bolaji A. Adetoye
3 min readNov 26, 2022

PuTTY, a free and open-source terminal emulator, is one of the great tools used to SSH into an AWS EC2 instance and it is commonly used for this purpose.

I just realised recently that the task automation and configuration management program called Powershell from Microsoft is well suited for easy access into an EC2 instance without downloading any third-party application and subsequent necessary configuration for access.

Let’s explore this by showing a few steps to achieve this.

Step 1: Create Key Pairs

Let’s create a keypair from the AWS Management console. Search for EC2 from the services search box on the Management console and click on EC2, locate the ‘Key Pairs’ link from the left menu bar. This is under the “Network & Security” menu as shown below.

keypair link on EC2 dashboard

Select the link and click on “Create key pair” button.

Keypair page

Give it a name. I will call it “ssh-ec2key”. Ensure the “key pair type” is “RSA” and “.pem” is selected under the “Private key file format”. Click “Create key pair” button. The result should look like the below screenshot. Note that two keys will be generated, a public key as shown below and a private key to be downloaded to your PC which will be needed to ssh into the EC2 instance later.

created public key

Step 2: Navigate to the path of the private key

From the Powershell, ensure that you navigate to the path of the downloaded private key. My “ssh-ec2key.pem” is located in my “download” folder in this path on my PC.

Powershell .pem path
My private key path

Step 3: Create the EC2 instance.

Select “EC2 Dashboard” and click “Launch instance”, give it a name. For example “My EC2 Instance”. Select “Amazon Linux 2 AMI…Free tier eligible”, “t2.micro free tier eligible” instance type. Select the key pair name as required(the public key). Select the default “vpc” and “subnet” under “Network settings”. Under “Firewall”, create a new security group. Select “Allow SSH traffic from” “My IP” (Here your ISP assigned IP will appear as an option to be selected). Accept the default storage configuration and click “Launch instance”.

EC2 instance succeffully created.

Grab the assigned Public IPv4 address as this will be used for the ssh access. Launch the powershell and ensure you are in the path of the private key, type this command from the terminal and hit the enter key.

ssh -i ssh-ec2key.pem ec2-user@
Successful access to the EC2 instance from Powershell

Type “exit” command from the terminal to close this connection and terminate your EC2 instance to stop unnecessary charges.

This can also be achieved by using windows command prompt (CMD).

Command prompt interface

I hope this has been informative and I will see you in the next one. Cheers!



Bolaji A. Adetoye

IT Tech. Support | Aspiring MultiCloud & DevOps Engineer | AWS | Microsoft Azure | Google Cloud | Oracle Cloud