|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.
|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.
|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
To configure PuTTY
- Launch PuTTYgen and load
id_rsa-gsg-keypair. PuTTYgen should pop up the following message.
Note The private key file must end with a newline character or PuTTYgen cannot load it correctly.
- 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.
- 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
- 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.
- Under Session, enter
root@. Click Open to connect to your Amazon EC2 instance.
SCP with PuTTY
The use of pscp is nearly identical to scp.
To use pscp
- 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.
Shell1$ </code><strong><code>scp -i id_rsa-gsg-keypair <em><code>pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem</code></em> <em><code>cert-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem</code></em> root@<em><code>ec2-72-44-33-55.compute-1.amazonaws.com</code></em>:</code></strong>
- 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.
Shell1C:> </code><strong><code>pscp -i id_rsa-gsg-keypair.ppk <em><code>pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem</code></em> <em><code>cert-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem</code></em> root@<em><code>ec2-72-44-33-55.compute-1.amazonaws.com</code></em>:</code></strong>