Connecting Amazon Instance with Putty

Introduction

[Note] Note
This section is for Windows users using PuTTY. If you are using another operating system or SSH client, you can skip this section.

PuTTY is a free SSH client for Windows. Other tools that form part of the PuTTY suite are PuTTYgen, a key generation program, and pscp, a secure copy command line tool. This guide outlines the additional steps required to use PuTTY with Amazon EC2.

[Note] Note
The different PuTTY tools are separate applications and might require multiple downloads.

Private Key Format

PuTTY does not natively support the private key format generated by Amazon EC2. Fortunately, PuTTY has a tool called PuTTYgen, which can convert keys to its internal format.

[Note] Note
You should have generated a private key as described in How to Get an SSH Key Pair and saved the key to a file named something like id_rsa-gsg-keypair.

To configure PuTTY

  1. Launch PuTTYgen and load id_rsa-gsg-keypair. PuTTYgen should pop up the following message.
    [Note] Note
    The private key file must end with a newline character or PuTTYgen cannot load it correctly.
  2. PuTTYgen displays a lot of information regarding the key that has been loaded, such as the public key, the key passphrase, the type and the number of bits in the generated key. The keys generated by Amazon EC2 are 1024 bit SSH-2 RSA keys. They are also passphraseless. A passphrase on a private key is an extra layer of protection, so even if your private key is discovered it will not be usable without the passphrase. The downside is that it makes automation harder as human intervention is needed to log on to an instance, or copy files to an instance.
  3. Save the key in PuTTY’s format. You can either select Save from the File menu or click Save private key. Save the key as id_rsa-gsg-keypair.ppk. When PuTTYgen prompts you to save the key without a passphrase, click Yes.The file can be used with PuTTY to connect to your Amazon EC2 host as described in the next section.

SSH with PuTTY

This section assumes that you have converted an Amazon EC2 generated private key file to a PuTTY private key file and have successfully launched an instance.

To use SSH with PuTTY

  1. Start PuTTY. A graphical configuration utility opens.Click Connection, point to SSH, and select Authentication. The PuTTY Configuration dialog box appears.Click Browse, and select the PuTTY private key file you generated earlier. If you are following this guide, the file is named id_rsa-gsg-keypair.ppk.
  2. Under Session, enter root@hostname or root@ip_address. Click Open to connect to your Amazon EC2 instance.

SCP with PuTTY

The use of pscp is nearly identical to scp.

To use pscp

  1. Convert your private key to PuTTY’s format. The command to copy the private key and X.509 certificate should look like the following example.
  2. To run the same command with pscp, using the private key in PuTTY’s format as generated in the preceding section, the command should look like the following example.