Tuesday, February 17, 2015

Convert .key/.crt to pem for use with AWS

I always have to look this up...  hence the post here...

Even though you might have a key file in text form, it won't work with AWS if you need to connect from ssh command line (keys work fine from Putty / WinSCP).

To convert a key file you also need the crt file.

Here's how from Mac / Linux command line:

openssl rsa -in server.key -text > private.pem
openssl x509 -inform PEM -in server.crt > public.pem

Once you have the pem, don't forget to:

chmod 600 public.pem

Otherwise you won't be able to use it to ssh to AWS.

No comments: