Last updated on September 21st, 2021 at 10:41 am
Connecting to Amazon EC2 instance requires you to provide the private key you download while creating the instance. If you are connecting from Windows laptop, most likely you will use PuTTY. Here’s how you convert .pem to .ppk. This is because PuTTY does not natively support the private key format (.pem) generated by Amazon EC2. PuTTY has a tool named PuTTYgen, which can convert keys to the required PuTTY format (.ppk). You must convert .pem to .ppk file before attempting to connect to your instance using PuTTY. You can download and install PuTTY if you haven’t already.
To convert your private key
- Start PuTTYgen (for example, from the Start menu, click All Programs > PuTTY > PuTTYgen).
- Under Type of key to generate, select SSH-2 RSA.
- Click Load. By default, PuTTYgen displays only files with the extension .ppk. To locate your .pem file, select the option to display files of all types.
- Select your .pem file and click Open. Click OK to dismiss the confirmation dialog box.
- Click Save private key to save the key in the format that PuTTY can use. PuTTYgen displays a warning about saving the key without a passphrase. Click Yes. Note A passphrase on a private key is an extra layer of protection, so even if your private key is discovered, it can’t be used without the passphrase. The downside to using a passphrase is that it makes automation harder because human intervention is needed to log on to an instance, or copy files to an instance.
- Specify the same name for the key that you used for the key pair (for example, private_key). PuTTY automatically adds the .ppk file extension.
Your private key is now in the correct format for use with PuTTY. You can now connect to your Amazon EC2 instance using PuTTY’s SSH client.
Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI & software development.