In this article, you will see how we can connect AWS EC2 instance via SSH/Putty from windows using a key-pair.
In previous article, we already learn how to launch an instance. Please click the below link.
Let’s start the process of connecting EC2 instance via SSH/Putty.
Step 1: Sign In to AWS Management Console and open EC2 Service.
* Sign In to AWS Management Console by using your credentials.
* In top search bar, you can write ‘EC2’. It will show ‘EC2’ service and after you click on it, it will redirect you to the EC2 Dashboard.
Step 2: Select the instance which you want to connect via SSH/Putty.
* After entering the EC2 dashboard, you will be given an overview of all EC2 resources for your chosen region.
* Click on the instance which you want to connect via SSH/Putty.
Step 3 : Download WinSCP and Putty.
If you have Windows operating system installed in your computer. Then you will need two basic software which will help you to connect the instance easily.
1. WinSCP : This will help you to upload and download files easily on the instance. You can use FileZilla as well in place of WinSCP.
2. PuTTY : This will help you to install required packages in your instance like LAMP, node.js etc.
If you have Linux operating system installed in your computer, then you can use terminal to connect instance.
1. Open your terminal, go to the directory where you placed your pem file(key-pair).
2. Type SSH command with this syntax:
ssh -i key-pair.pem username@ip-address
So, terminal(Linux/Ubuntu) will work like PuTTY(in Windows) to install required packages in your instance like LAMP, node.js etc.
3. You can use FileZilla to upload and download files and folders. Here you need to configure ssh key-pair in FileZilla settings.
Step 4 : After Installing WinSCP and PuTTY, create new session in WinSCP.
* Open WinSCP and click on ‘New Session’.
* Use AWS EC2 Instance public IP as a host and enter rest of the details as below screenshot. ‘ec2-user’ will be the username because it is default for the Linux instance.
* Keep the password fields blank, because we are going to use key-pair in place of password.
Click on ‘Advanced’ button, then select Authentication. Under Authentication tab, you will need to select private key file as shown in below image.
If you have pem file but don’t have ppk file, then puTTy will automatically generate the ppk from the pem file. For this you need to select pem file by enabling the option to ‘All files’.
* After that please click in ‘Login’ and you will get Logged-In in 2-3 seconds.
Step 5 : Connect Instance in PuTTY.
In below image of WinSCP, you can see an icon in the middle marked in red. It is PuTTY icon, which is already enabled by WinSCP.
When you click on that it will automatically logged you in, because key is already configured.
2 thoughts on “How to connect to AWS EC2 instance via SSH/Putty from windows using a key-pair?”
Pingback: How to install a LAMP web server on Amazon Linux 2? - The Technical Diaries
Pingback: How to create AWS EC2 instance step by step Linux 2022. - The Technical Diaries