How to Convert a PuTTY .ppk Key to an Amazon .pem File on macOS

When working with Amazon Web Services (AWS), you may need to use SSH key pairs to access your instances securely. AWS typically uses .pem key files, while PuTTY, a popular SSH client for Windows, uses .ppk key files. If you’re using macOS and have a PuTTY .ppk key that you want to use with AWS instances, you’ll need to convert it to the .pem format. In this article, we’ll guide you through the process of converting a PuTTY .ppk key to an Amazon .pem file on macOS.

Follow these steps to convert your PuTTY .ppk key to an Amazon .pem file:

Step 1: Install Homebrew (if not already installed)

Homebrew is a package manager for macOS that simplifies the installation of various software packages, including PuTTYgen.

To install Homebrew, open your Terminal and run the following command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2: Install PuTTYgen

With Homebrew installed, you can easily install PuTTYgen by running the following command in your Terminal:

brew install putty

Step 3: Generate a .pem key using PuTTYgen

Use the below command to convert ppk to pem file

puttygen /path/to/your/putty-key.ppk -O private-openssh -o /path/to/your/output-key.pem

Replace /path/to/your/putty-key.ppk with the actual path to your PuTTY .ppk key and /path/to/your/output-key.pem with the desired location and filename for the .pem key.