In this article, I will tell you how to connect the AWS ec2 Linux instance using SSH from windows. The SSH client is Putty which is free and you can download it from the internet.
1. Download & Install Putty.
- You should first download & install the putty software from the putty official website.
- After installing the putty, you can find 2 applications PuTTY & PuTTYgen.
- These 2 applications are very useful and we will use them later.
2. Using PuTTYgen To Convert .pem File To .ppk File.
- Open the PuTTYgen application.
- Click the Load button to open the browse file window.
- Select the AWS SSH used .pem file, you can do this by changing the file types to all files in the file types drop-down list.
- After selecting, it will pop up an alert dialog saying Successfully imported the key .etc.
- Click the OK button in the pop-up alert dialog.
- Then you can see the key text in the public key text area.
- Select the RSA radio button in the Type of key to generate section.
- Click the Save private key button to save the private key to a .ppk file in the computer.
- Now you have successfully converted the AWS SSH used .pem file to a .ppk file.
- PuTTY client will use the .ppk file to connect to the AWS ec2 Linux instance using SSH.
3. Using PuTTY To Connect To AWS EC2 Linux Instance.
3.1 Input AWS EC2 Linux Instance Address.
- Open the PuTTY client, and click the Session item in the left Category list.
- Input the AWS ec2 instance address such as ec2-user@ec2-******.ap****ompute.amazonaws.com in the Host Name (or IP address) text box.
- You can get the instance address by right-clicking the EC2 instance in the AWS console, then clicking the Connect item in the popup menu list, then clicking the SSH client tab.
- The default user name should be ec2-user and not root, this is because of security reasons.
- The Port number is 22, you do not need to change it.
- Select the SSH radio button in the Connection type section.
- Input a name in the Saved Sessions text box and click the Save button to save it, then you can use it later easily by loading it again.
3.2 Keep PuTTY Connect To SSH Server Without Lose Connection.
- Click the Connection item under the Category list in the left pane.
- Input a number such as 180 in the right pane text box Seconds between keepalives(0 to turn off).
- Then PuTTY client will keep alive with the Linux SSH server every 3 minutes, it will not lose connection to the SSH server.
3.3 Use PuTTY Private Key File For Authentication.
- Click the Connection —> SSH —> Auth —> Credentials item in the PuTTY Configuration window left pane.
- Then click the Browse button on the right pane after the Private key file for authentication text box.
- Select the .ppk file which you converted in section 2.
- Click the Session item in the left pane and click the Save button to save all the configurations.
- Then click the Open button to connect to the SSH server.