How do I convert my Amazon EC2 Privacy Enhanced Mail (.pem) file to a PuTTY Private Key (.ppk) file? Or, convert a .ppk file to a .pem file?

PuTTY does not natively support the private key format (.pem) generated by Amazon Elastic Compute Cloud (Amazon EC2). You must convert your private key into a .ppk file before you can connect to your instance using PuTTY. PuTTY has a tool named PuTTYgen, which can be used by both Windows and Unix operating system users to convert keys.

Windows - Install PuTTYgen

Most Windows operating systems have PuTTY installed. If your system doesn't, download and install PuTTYgen.

Windows - convert a .pem file to a .ppk file

Start PuTTYgen, and then convert the .pem file to a .ppk file. For detailed steps, see Converting Your Private Key Using PuTTYgen.

Windows - convert a .ppk file to a .pem file

  1. Start PuTTYgen. Under Actions, choose Load, and then navigate to your .ppk file.
  2. Choose the .ppk file, and then choose Open.
  3. Choose Conversions from the menu at the top of the PuTTY Key Generator, and then choose Export OpenSSH Key.
  4. For the PuTTYgen warning Are you sure you want to save this key without a passphrase to protect it?, choose Yes.
  5. Name the file and add the .pem extension.

Unix or Linux - install PuTTY

Install PuTTY, if it's not already on your system, by running one of these commands:

RPM-based

$ sudo yum install putty

Dpkg-based

$sudo apt-get install putty-tools

Unix or Linux - convert a .pem file to a .ppk file

On the instance shell, run the puttygen command to convert your .pem file to a .ppk file:

$ sudo puttygen pemKey.pem -o ppkKey.ppk -O private

Unix or Linux - convert a .ppk file to a .pen file

Run the puttygen command to convert a .ppk file into a .pem file:

$ sudo puttygen ppkkey.ppk -O private-openssh -o pemkey.pem

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2018-06-01