AWS Private Keys with Puttygen

28 09 2015

So I’ve fired up an AWS account finally, to have a practise, using only Free-tier instances etc.

To generate my private keys for logging in to the Linux instances, I created a new one with each instance, converted it to Putty format using Puttygen, and then added it in to the config for the instance under SSH –> Auth for the settings for each instance in Putty.

Although it worked fine intially, creating keys started to throw up errors after a while when attempting to import them in to Puttygen for the purpose of converting to .ppk format. Sometimes it would work using exactly the same process, and sometimes not. The specific error was ‘Couldn’t load private key (unexpected end of file)’.

I Googled, but couldn’t find anything of much use – mostly people moaning at Amazon on forum posts from 2011 🙂

I had a play and have now found that adding an extra ‘Carriage Return’ (pressing ‘Enter’) at the end of the .pem file, before loading in to Puttygen, consistently results in a smooth import process. I’ve tested by creating multiple instances, generating a new private key for each, and then adding the new line if it errored upon import to puttygen. I then deleted the instances and repeated the process. I haven’t had an error yet when doing it this way.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: