3 Answers
Thanks for highligting that – despite the documentation (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#having-ec2-create-your-key-pair) saying: "he file name extension for this file is not important." the slelection screen won’t let you select the key unless the extension is .pub
Yes I’m having the same problem when I try this now and I don’t know why. I wonder if something has changed internally in the way this works on the AWS side now, or the latest version of OpenSSL is possibly incompatible.
On my MAC, I got it to work using:
ssh-keygen -t rsa -b 2048
It will ask you to name the file and then automatically creates a .pub file which looks like this (your public key):
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7AwipjMn6/OklM7U6sExBFlCsOAIKT8HSPH0ZAfw+h6d7MOkcYWvmK/Kw1RYxp/PO982z2A3H0SfC6mYUTx5fmMieBlO6W/CFGblWHaXLwv6SQUvX6vqOcvWv2lZ6BJgYufg0rZKP6JIOI1IcqNYEunbaedK8v4uK5bn4P6y7VwNk6zaCjDlsWqlHEYRJljzILP5PJfpq3dFNouvX+iiz+POaTudGjKui6wUhy9XWTxSefiswxLZ0JyNm6WbT9GAdcOcsdFQgE+g4MPFUvWHiIkDLAPu62JiOwE/4408CmH/+E3B5nP1DXru6r7F51k0ZQXFTFgJqaMutJsLl4cFr fayeellis@myhostname.local
(remove the last bit with yourusername@yourhost.local )and then this file can be imported into the console.
I’ll talk to Ryan about updating this lecture!
thanks all
Faye
This worked for me as well while using the new EC2 Interface.
This would appear to be a bug in the upgrade to the AWS Console User Interface for EC2. If you deselect the "New EC2 Experience" in the top left menu pane it reverts to the old User Interface and allows you to import the file as per the video. I have notified AWS via the "Tell us what you think" feedback link.
I tried several times and could not get it to work with openssl. When generating the public key with a different command, it works: ssh-keygen -t rsa -b 2048 The generated public key looks different. It starts with ssh-rsa AAAAB3NzaC1yc2EAAAADA…. While the first generated one starts with —–BEGIN PUBLIC KEY—– MIIBIjANBgkqhkiG….
note I downloaded the most current "openssl-1.1.1d" I’m not sure if that is making a difference. I also tried "openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pub" and while it read the file, it would not import.
Robert, thanks for that tip. I had the same issue with my Mac. I generated the key pair with your steps and was able to import successfully.