Dot Net For All

How to login(SSH) AWS EC2 Linux Instance from Windows

Hello Friends, In this article I will provide steps to connect(SSH) AWS EC2 Linux Instance from Windows using putty. Please follow the below steps to login to Linux instance.

Connect to AWS EC2 Linux Instance from Windows.

  1. First we need to download the puttygen.exe and putty.exe from the link provided here : https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
  2. The first  requisite to login into the the Linux instance is to host the instance in a public subnet. You can read my previous article here on how to create a public subnet.
  3. Once you have created a public subnet you have to select the VPC and same subnet which you have created. As you can see in the figure below I have selected the VPC and public subnet in the “Configure Instance” step.
    Selecting A VPC with Public Subnet

     

  4. And the next important step would be to place the instance in Security group which allows SSH in the instance. As can be seen in the figure below I have created a new security group in the “Configure Security Group” step of the instance creation.
    Security Group creation for Linux instance SSH

     

  5. Now we have to download the private key pair. If you already have a private key, in that case there is no need to create new. If you do not have a key pair you can download it as shown in the figure below.  I have created a new key pair named “MyNewKeyPair”. You have to keep it at safe and known place as once created you cannot recreate it. Click the “Download key Pair” and fianlly “Launch Instance”
    Create Key Pair

     

  6. Once you have launched the instance you can make note of the public IPv4 address as shown in the figure below.
    Public IPv4 address of AWS Instance

     

    Using Putty to Connect(SSH) AWS EC2 Linux Instance from Windows

  7. Open puttygen.exe and upload the newly downloaded .pem file. Putty gen will convert the .pem file to .ppk file. Putty uses .ppk file to SSH to the Linux EC2 instance.
  8. Click on Load. And once you have loaded the .prem file click “save private key”. You will be prompted to save the private key without password. Click yes if you do not want to have password for .ppk file.

    ppk file generation using putty gen

  9.  Open the putty.exe. Enter the host name as ec2-user@publicIP. and port 22. Use the same for saved session as shown in the figure below if you want to save the session for future use.
    Using putty.exe

     

     

  10. Go to SSH > Auth and upload the .ppk file which we created in previous step. The file should be uploaded under “Private key file for Authentication:”. And Click Open.
    Upload the .ppk file

     

  11. Wow and here we are in the SSH session of our EC2 instance as shown in the figure below.
    AWS ec2 Linux SSH login

     

    Conclusion:

  12. I hope you like this step by step article to SSH to AWS EC2 Linux Instance from Windows using putty. We have covered how to make a Linux instance reachable by assigning a public subnet of a VPC and allowing port 22 through the security group assigned to the EC2 instance.

Top career enhancing courses you can't miss

My Learning Resource

Excel your system design interview