Connect to Amazon EC2 Linux Instance from Windows

Well this is my first attempt ever doing this. So thought may be helpful for somebody in same situation. Remote Desktop won’t work so you have to use Putty and Puttygen.  Note that when you first try to connect from Amazon EC2 console to your Linux instance, the Amazon connect dialog will tell you to use Putty but it does not mention about Puttygen and anything about the conversion of your private key required to be used with Putty.

First convert your Amazon private key file using Puttygen to something Putty understands. You can optionally encrypt the converted file using a password (I recommend). Then follow the steps below:

1) Run Putty
2) Enter your Linux IP, Use SSH and Port 22
3) From left side menu choose Auth/SSH and locate your converted private key file
4) Give a session name and save the session. Load the session and click on Open.

The terminal window will be displayed and it will ask you to enter login user. Enter “ec2-user” instead of “root”.  It will use the converted private key file. If the file was converted/encrypted using a password it will ask you to provide the password here. You should be logged in.
At the $ prompt you may want to change the root password. so type in the following command:

$ sudo passwd root

Then follow the instructions on the screen. This site has some cool information (including about WinSCP, a free SFTP and FTP client for windows) if you want to know more. Good luck.

Updated (17-Nov-10):

To prevent remote root exploits the Amazon Linux AMI does not allow remote root login via SSH. Also, password authentication is disabled to prevent brute force password attacks. To enable SSH logins to a running Amazon Linux AMI you must provide your key pair to the instance at launch. You must also set the security group used to launch your instance to allow SSH access. By default the only account that can be logged into remotely via SSH is ‘ec2-user’. The ec2-user has sudo privileges.


13 thoughts on “Connect to Amazon EC2 Linux Instance from Windows

  1. Hi,
    I am using an ec2 linux server and am trying to connect to it from a Windows XP machine. SSH works fine but it is very tedious to use. Are you saying that I cannot get the remote desktop to work? I did enable RDP on the EC2 machine but do not know how to proceed. Your help would be appreciated.

  2. Thank you, don’t mean to sound unappreciative, but you glossed over “First convert your Amazon private key file using Puttygen to something Putty understands.”

    What does this look like?

  3. there is a way to bypass it
    i now configure it in a way i can remotely login to my Amazon EC2 Linux instance with root user (directly).
    the way to do it is edit /etc/ssh/sshd_config
    let me know if more info is needed i will tell you what to change there exactly.

    also , there is a way to change the root password (i did that before connecting directly with the root user)

    1. Hello, I also use WinSCP to copy files to my ec2 instance. However, it would be great if I could log on as root. Above you mention something to edit in the sshd_config. Would you mind telling me more in the best detail possible please? Thanks so much!

  4. I have follow the above step but by connecting the puuty it show the errot
    network error: connection refused. can any one suggest the solution .. for sucessfull connection

  5. Thanks for this post. I got help from it even though I was looking for something else. Just to provide feedback: I have a new sample PHP app hosted on EC2 and all I wanted to change the index.php. I was connected to it using ssh but it was not letting me change the permission on the index.php to 777 (chmod 777). Perhaps I was not the root user or whatever (I am not in to Unix). What I tried though (From your article) was suod passwd root and changed the root passwd, logged in as root and then I was able to chmod and eventually change the index.php and got it to work. I know I might not have done the most elegant thing but it is 1:30 AM and I badly wanted my Hello World Facebook app to show the f***ing string “Hello, World”. It does now… and Thank You for that… :-))

  6. If you use the AWS Toolset from you can connect to your EC2 instances via SSH directly using the original .pem file without having to convert it to the .ppk format. If want to use Putty you can still do that using the tools integration feature.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s