In AWS, if you launch any EC2 Linux example, you need to choose a key pair for that exact example.
AWS key pair will likely be in the usual exclusive key format with .pem file extension
However in case you are utilizing PuTTY in your Home windows laptop computer to login to AWS example, you might have an issue.
PuTTY doesn’t assist PEM format. PuTTY understands solely it’s personal PPK format.
PPK stands for Putty Non-public Key.
So, you need to convert your .pem file to .ppk file.
For this conversion, putty supplies a instrument referred to as PuTTYgen.
1. Obtain AWS PEM file
In AWS, if you first create a key pair file, that you simply need to use to your EC2 cases, AWS will assist you to obtain the PEM file to your native machine. Save this PEM file someplace in your machine.
On this instance, the .pem file I’ve is named thegeekstuff.pem, which is underneath C drive.
We’ll be changing this thegeekstuff.pem file to thegeekstuff.ppk and use the .ppk to login to EC2 example utilizing PuTTY.
BTW, the steps to transform pem to ppk for putty is strictly the identical for all of the Linux AMI photographs, together with CentOS, RedHat, Ubuntu, SuSE, Fedora, Amazon Linux, and many others.
2. Obtain PuTTYGen
Obtain PuTTYgen from right here.
In the event you’ve used the PuTTY MSI installer, then all of the PuTTY utilities comes with it together with puttygen.
In case you are already utilizing solely putty.exe as a standalone, then it’s also possible to obtain the standalone puttygen.exe
Launch PuTTYgen by double clicking on it.
PuTTYGen is a RSA and DSA key technology utility. However, in our case, we’ll be utilizing this to transform the pem to ppk file.
The principle PuTTYGen display can have the next three sections:
Key Part: It will show the present key that’s loaded. i.e The important thing that you’re at the moment engaged on. Whenever you first launch the puttygen, this part will say “No Key”.
Actions Part: This part will show all of the potential actions that you would be able to carry out inside PuTTYGen. The next are the out there actions:
- Generate – It will allow you to generate a model new public/exclusive key pair
- Load – If you have already got an present exclusive key, you should use that by loading it right here
- Save – When you’ve generated a brand new key, or loaded an present key, it can save you both the public-key or the private-key to your native machine. Initially the save buttons will likely be disabled, as we’ve got not loaded a key but.
Parameters Part: Right here you’ll specify the kind of key to generate. You have got three choices right here: SSH-1 (RSA), SSH-2 (RSA), SSH-2 DSA. You may as well set the worth of variety of bits for the generated key. By default the kind will likely be SSH-2 (RSA) and 2048-bit.
For our goal of changing PEM to PPK, depart all of the parameters at their default worth. i.e SSH-2 (RSA) and 2048 bit.
See additionally: 10 Superior PuTTY Suggestions and Tips You Most likely Didn’t Know
3. Load PEM file to PuTTYGen for Conversion
Within the following PuTTYGen most important display, click on on “Load” button, and choose your AWS PEM file.
Please be aware that if you click on on “Load”, within the file choice window, by default, it’s going to present “PuTTY Private Key Files (*.ppk)” as the choice. Click on on this drop-down listing and select “All Files” as proven beneath. After this, you possibly can browser to the listing the place you *.pem file is positioned, and cargo it.
As soon as the *.pem file is loaded, you’ll get a pop-up message saying “Successfully imported foreign key (OpenSSH SSH-2 private key)”. Click on on “OK” on this display.
4. Save your Transformed PPK Non-public Key
Now that we’ve got the keys loaded, you’ll see within the prime “Key” part, our key data will likely be displayed. It will show the important thing fingerprint, key remark. The important thing passphrase on this case will likely be empty, as we didn’t have any passphrase for our AWS PEM file on this instance.
Additionally, within the motion part, we’ll see the save button enabled.
Click on on the “Save Private Key” button, to save lots of our transformed ppk exclusive key.
It will show a warning message saying: “Are you sure you want to save this key without a passphrase to protect it?”. Click on on “YES”.
Now, give a reputation to this file. In our case, I’ve named this transformed file as thegeekstuff.ppk
5. Use the PPK File in PuTTY
Now, that we’ve got the thegeekstuff.pem AWS PEM file transformed to thegeekstuff.ppk PuTTY key file, we are able to use this to login to our AWS EC2 example.
For this, launch the putty, and do the next:
First, within the “Host Name (or IP address)” discipline, enter the public-dns or ip of your AWS EC2 example.
Second, within the “Saved Sessions” discipline, enter the title that you simply wish to give for this AWS-EC2-instance in your putty, and click on on “Save” to save lots of this periods in your putty listing.
Third, on the left-hand aspect panel, develop the “Connections” -> develop “SSH” -> choose “Auth”. Click on on “Browse”, and choose your transformed ppk file for the “Private key file for authentication” as proven beneath.
Fourth, at this stage you possibly can click on on “Open” to begin the connection, however you’ll lose the values that you simply simply entered. So, on the left-panel click on on “Sessions” once more, and click on on “Save” once more. It will save the details about the exclusive key that you simply offered to the putty-session that you simply saved earlier.
6. PEM and PPK File Codecs
When you’ve transformed the file, you possibly can view the content material of PEM and PPK file in a textual content editor, and also you’ll see that the content material seems completely different, as they’re of various codecs.
PEM Key File from Aamazon EC2 (e.g: thegeekstuff.pem)
-----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAiwcGGeEzqHr0j/2yr95EHcKQwO7P IL43rY5eNAbWqm5bwr3IgDmNC2aram/j9hVo2XIQzsCY u3XvCd5SvM56tSb2h+OND6rxkM4pJhPRG/sMehndqsaj 0IkLxgn4xCXU9rQZbWEgryQDnONY6eOyg7vYykI0YdKE .. .. Ho4cV+2gmeGopyZTj3QfHMKTghilJsMdBCGmYkip1VUT JU2OSlE82l2k07FSfH8lvLNI7odj1ZUK2OqsD5Pca5hu Uk7hWJuqSMsfKeU4AKAt7/WdtAUmmoA7eH9dKjXRg1sX V6I76uLcRHRmPDJVwuUzf4ppX1sLFtAcIwro98ZBGudz HO4cTkaSwOk6JJD2XcJ4+XgKzLimt/njP3e5y0gzVriy -----END RSA PRIVATE KEY-----
The PPK file format (e.g: thegeekstuff.pem). That is the file that we transformed utilizing PuTTYGen instrument. That is the keyfile format that can work in your PuTTY to login to your Amazon AWS EC2 Linux example utilizing SSH protocol as proven above.
PuTTY-Consumer-Key-File-2: ssh-rsa Encryption: none Remark: imported-openssh-key Public-Strains: 6 AAAAB3NzaC1yc2EAAAADAQABAAABAQCLBwYZ4TOoevSP u7I5zV+GPx+ov76VDNQKGb89jDAgvjetjl40BtaqblvC chDOwJim6MbEws4AXuLVyUq9O1Dw5qRVKsI2Xoi7de8J zikmE9Eb+wx6Gd2qxqPuftJqbGjAzin0+voGlWH18Zeg tBltYSCvJAOc41jp47KDu9jKQjRh0oSkDQ88l19zXgqp jhxX7aCZ4ainJlOPdB8cwpOCGKUmwx0EIaZiSKnVVRMU Non-public-Strains: 14 AAABAATq1K5pprgY0TmekYli5SngTdplF/PKfbUJKn6c nj0qPTHoTTCt5T3V9Wzn5YWTg4eZtApptrhnfXPjcvC9 .. .. 6PfGQRrnc4CXbW/vxw/K4w7RAp53zs0d3P18EE3i3xzu Csy4prf54z93uctIM1a4skfy1GFiM3ujTOxskhU5OLXb Non-public-MAC: 0827d5872ec564e75b370bc3eb6ddcc