Connecting instance from Windows using PuTTY.
Welcome,
In this post I will be discussing about how we can connect our EC2 instance using PuTTY in windows.PuTTY is a free and open-source terminal emulator and network file transfer application.It is a very versatile tool for remote access to another computer.It provides a secure remote shell access to UNIX or Linux system.PuTTY plays an important role as the only way of talking to your EC2 machine is by SSH(Secure SHell) protocol.We need SSH client that will run on Microsoft OS.Most people in world are using Microsoft OS.If you use linux,you can use OpenSSH.PuTTY is a Windows SSH client.
Now how to connect your instance to PuTTY?
Firstly,you have to understand that PuTTY can’t use PEM(Privacy enhanced mail) files.When you created your first instance the AWS console gave you a private key to save for future use.
You have to convert it into PPK format.For that, follow below steps:
- Download PuTTY from https://www.putty.org/ .
2) Open PuTTYgen.It will have 3 panes as Key,Actions and Parameters.
3) Now locate where you saved your PEM file.Then,click Conversions → Import Key → Load private key.
4) Choose Load. By default, PuTTYgen displays only files with the extension .ppk. To locate your .pem file, choose the option to display files of all types.Open the PEM file.Make the changes in paraphrase.
5) Create PPK file.Click “Save private key” button.
Interesting Fact: The PuTTY app comes with an SSH authentication agent called Pageant.It’s purpose is to keep all your private keys ready for PuTTY to use.PuTTY needs your AWS private key whenever you want to connect to your EC2 machine.
Till now you have gone through how you can convert your PEM file to PPK file.
Now let’s go ahead and see how you can access your EC2 instance through PuTTY via SSH.
1) Launch your EC2 instance as discussed in previous post.You can verify by visiting your running instances dashboard and check if instance is running.
2) Start PuTTY.(Start->Search->PuTTY)
3) In the Category pane,choose Session and complete the details:
a) In the Host Name give IP address of your instance or use your instance’s public DNS
name.
b) Ensure the port value is 22.
c) Now,under Connection Type select SSH.
d) To avoid getting disconnected from your instance choose connection and enter the
interval in “Seconds between keepalives”.
4) Now,in the Category pane,expand connection and SSH.
5) Click on “Auth” → “Browse”.
6) Select the .ppk file.Choose Open.
7) If you are doing this for first time,PuTTY will display an alert box to ensure whether you trust the host or not.
8) Choose Yes. A window will get open in front of you and that’s it.
You are connected to your instance.
Remember,the default username for the Amazon Linux AMI is ec2-user .
If you have any issues regarding connecting your instance visit https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html .
Hope this post helped in connecting your instance.
Thank you for reading.