How To Connect Amazon EC2 Linux Instances Using Putty

Connect Amazon EC2 Linux Instances Using Putty

In this tutorial, you will learn to connect to AWS Linux Ec2 instances using the Putty SSH client through step by step guides.

From a Windows system, you can connect to an Amazon ec2 Linux instance using Putty or the Java plugin option provided by AWS. However, The best way to connect to a Linux EC2 instance from Windows is using putty.

Connect to Ec2 Linux Using Putty

Follow the steps given below to SSH into a Linux ec2 instance from a Windows system using the putty utility.

Step 1: Download Putty & Puttygen

First, download Putty from here – Download Putty

You need to download both puttygen.exe and putty.exe.

The key file you download from the AWS console will be a .pem file. Since Putty uses .ppk file extensions for authentication, you need Puttygen to convert the .pem file to .ppk format.

Step 2: Convert .pem to .ppk using putty gen

Open puttygen.exe and load the .pem private key you downloaded when you created the ec2 instance.

It looks likeexample.pem. Once you open the .pem file a pop-up window will appear, asking you to save the private key. Click OK and click the save private key button.

Save the .ppk file in any folder.

Note: Do not click generate a key or any other buttons. Just load the pem file and click the save the private key button.

generate .ppk file from .pem file.

Step 3: Connect to the ec2 Instance using SSH client putty

Open putty.exe and enter the hostname or IP (public or elastic IP)  as shown in the image below.

Eg: “ec4-50-18-154-285.compute-1.amazonaws.com” or if you have given an elastic IP for your instance, then you should enter that elastic IP in the host field.

putty configuration to connect to ec2 instance.

Now go to connection–>data and type in the user name.

username differs for different instance types.

The following table contains the default usernames of different AWS AMIs.

EC2 AMIDefault Username
Ubuntuubuntu
Debianadmin
CentOScentos or ec2-user
Fedorafedora or ec2-user
RHEL ec2-user or root
SUSEec2-user or root
Oracleec2-user
Bitnamibitnami
entering username in putty

Now go to SSH–>Auth click on Auth and load the .ppk file you generated using Puttygen.

add ppk file to putty to connect to ec2 instance.

Click open. The connection will be established.

established connection to ec2 instance from Putty.

You don’t have to give any username or password because the connection will be established using the private key.

If you get any errors while connecting, leave a comment below. The figure shown below is a connection established using the username “ubuntu“. 

Common Putty Errors

Following are the common putty errors that you might encounter when trying to connect to the ec2 server.

  1. Authentication with public key “imported-openssh-key” Please login as the user “ec2-user” rather than the user “root”.”
  2. PuTTY Fatal Error: Disconnected: No supported authentication methods available (server sent: public key) OK
  3. Disconnected: No supported authentication methods available (server sent:public key)
  4. Connection Timeout Error 

Here is what you can do to rectify the above putty ec2 errors.

  1. Ensure the ec2 instance security group allows port 22 connection from the system you use putty.
  2. Ensure you are using the correct username of the server. Please check the default username I have listed above in the table.
  3. Ensure that you are using the correct private key. Sometimes when you copy the private key as text, it might add some extra characters and corrupt the critical file.
  4. Ensure the corporate proxy allows you to connect to the ec2 IP address.

Transfer Files from Windows To Linux

You can transfer files from Windows to Linux in different ways.

Following are the common ways.

  1. Using PSCP utility
  2. Using WinSCP
  3. Using FileZilla FTP client

For detailed steps to transfer files to Linux from Windows, follow the step-by-step guide on copying files from Windows to Linux.

Conclusion

Putty is available for both Windows & MAC systems. However, it is primarily used in Windows systems to connect to Linux servers over SSH protocol.

0 Shares:
9 comments
  1. Pingback: How To Install and Setup Drupal On Amazon EC2 InstanceComtechies
Leave a Reply

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

You May Also Like