A few weeks ago I was working on a project in which the existing developers had setup access to their AWS EC2 instances using putty as their ssh client due to them running on Windows 7. They provided the putty private key file they setup but that didn’t do me any good because I was running OS X. Here is a list of steps I took to convert that PPK file to a PEM file that I could use to SSH into any EC2 instance.
- To start you will need either macports or homebrew.
- if using macports you will run the following command to install putty for mac:
Shell1sudo port install putty
- if you are using homebrew you will run the following command to install putty:
Shell1sudo brew install putty
- The remaining commands will be the same when using macports or homebrew. To generate the pem file run the following command:
Shell1puttygen privatekey.ppk -O private-openssh -o privatekey.pem
- Next you should place the privatekey.pem file in your ~/.ssh directory
- Now, lets set the pem file to have the proper permissions:
Shell1chmod go-rw privatekey.pem
That’s it. You now have a valid pem file that you can use to connect to your EC2 instances from your Mac. Below is an example of the command you can now run to connect to your instances:
ssh -i privatekey.pem email@example.com
That’s it for this post, hope this helps someone out in the future. And by someone I most likely mean future me!