When first setting up an Amazon EC2 server, you receive an ssh key to connect to the instance. This article details how to use a PuTTY private key to connect to your Amazon EC2 Linux instance. Previously, we used ssh on the OS X terminal and our .pem key file in order to connect. However, that didn’t work for our Windows users because .pem files are used with ssl (openssl). We will show you how to download all the PuTTY tools needed, create your private key, connect to your instance. We will also show you how to connect to your instance without an SSH key. The video included shows the practical application of the information written in the article below.

We are going to assume you’ve already followed the previous Amazon Screencasts and you have your .pem file and are ready to connect to your instance.

1.) Download the PuTTY resources needed to connect to our instance, PuTTY Download page. Go ahead and download the PuTTY and PuTTYGen executable files to your desktop.

2.) Open the PuTTYGen executable and your screen should look like the image below. This is where we are going to take your .pem file and convert it into a putty private key.

3.) Select the “load” button and Windows Explorer should appear for you to select a file. You will have to select the option to view “all” files as the image shows. From there you will load your .pem file.

4.) Once you’ve loaded the .pem file your screen will look like the following. Once this is complete select “Save private key.” It will ask you if you want to save without a pass code. You may choose to use a pass code but it is not necessary.

5.) Open PuTTY and enter your host

6.) Select “data” on the left hand side under “auto-login username” enter the user “root”

7.) Select “Auth” on the left hand side then under “private key for authentication” select the .ppk file we just created with PuTTYGen.

8.) Go back to the top and connect to your instance.

Thanks for reading–the video above also shows how to do these same steps.

AWS Labs

22 responses to “Connect To Amazon EC2 Linux Instance Using PuTTY Private Key On Windows”

  1. Mark Nett says:

    Thanks! I have got a .Pem file & was looking for instructions on how to get into ec2 server.
    The instructions you provided are clear & useful thanks James.

  2. jaffe says:

    Could use some more in depth information on sshd. Getting an access denied and not sure how to allow access.

  3. Greg says:

    AWESOME! Thank you so much!

  4. randeep says:

    is there anyway I can convert .ppk file to .pem ?

  5. Devin Walker says:

    Worked like a charm. Thanks for this… Windows users unite!

  6. Shams says:

    Simply awesome..

  7. Aaron says:

    Well done, thanks for the very helpful info.

  8. shwetanka says:


  9. Tom says:

    This was really helpful, thank you!

  10. Darkest says:

    Thanks! That’s helped.

  11. […] Installing Drupal And Linux Lamp Stack On Ubuntu Amazon EC2 Anthony James —  July 31, 2012 — Leave a comment In this screencast we are going to start from the very beginning and create our own EC2 cloud hosted Drupal installation. This will allow us to have full control of our Linux server and Drupal installation. We will walk through the process of setting up an Amazon EC2 instance, download and install Apache2, MySQL, PHP5, and phpmyadmin. Using these tools, we can create a Drupal database and host a Drupal website. Finally, we will download and install Drupal to our web server, create a Drupal database, configure the Apache site directory and install our Drupal website. At the end of the screencast we will have a running server and working Drupal website. For Windows users that want to connect with putty: Connect To Amazon EC2 Linux Instance Using PuTTY Private Key On Windows […]

  12. Chuck Fox says:

    I just followed this guide and it refused a root login. Changing the username from “root” to “ec2-user” worked fine though. I was then able to login and “sudo su” to root user. Maybe this is a recent change?

    • Anthony James says:

      It depends on the distribution. For example if you are using Ubuntu it will require you to use Ubuntu. If you are using amazon Linux, it want’s you to use ec2-user.

      Thanks for the comment.

  13. Mohamed Rafi says:

    Thank you so much for a great guide. It worked perfect.

  14. You have to use “ec2-user” user instead of “root”

    • Anthony James says:

      Well that is only on some instances. You need to look at your instance type and connection string. For example, ubuntu servers are “ubuntu@” amazon is “ec2-user@” and other ones such as Debian are root@

  15. Akretep Sebas says:

    It worked perfectly! Thank Antony. By the way it is plaisant to hear te tune of your voice. Calm…
    So… after this i gest there is still a long way to go to me to rdp my instace from windows (mstsc) right? I guess i ave to install ubuntu evirnment trought my putty console and also a rdt protocole. Am not sure i’ll make it whitout any help. Is there tutorials about this procedure?

  16. Kofi says:

    Thanks a lot!

  17. Yoosuf says:

    Thanks a Lot very help full

  18. waseem says:

    Thanks. it helped.

  19. mauro says:

    I got Network Error, connection timed out, any idea of what I could be doing wrong?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get actionable training and tech advice

We'll email you our latest articles up to once per week.