EC2 Key Pairs Fingerprinting
Ever happened to you that you wanted to know which SSH key you need to connect to an AWS EC2 instance? I always found that the fingerprints don’t tell me much, espcially because I always forget how to compute the fingerprints. Good that I’m back to writing, so I’m dumping my memory here:
- if the key was generated by AWS, then use
openssl pkcs8 -in path/to/key.pem -nocrypt -topk8 -outform DER | openssl sha1 -c
- if the key was generated using
ssh-keygen
then useopenssl rsa -in path/to/private/key -pubout -outform DER | openssl md5 -c
Why does AWS uses one format and why SSH other? Escapes my current knowledge.