Last Updated: February 25, 2016
·
2.818K
· ftsanjuan

Retrieving ssh public key from a .pem file

If you've ever needed to retrieve the public key from a .pem private key file (like you might get from EC2), you could try this:

ssh-keygen -y -f key.pem > key.pub

key.pem is the path to your .pem file (your private key) and key.pub is the path you want to write the public key to.