Certified Security - Specialty

Sign Up Free or Log In to participate!

key files not able to be selected (Mac)

Trying to import a public key for EC2. The UI has changed, but when I browse to the file location, all .pem files are grayed out and cannot be selected. The AWS doc says extension makes no difference, but I changed the public key to .pub just in case and it still doesn’t work. Any thoughts or ideas?  I checked my previous EC2 keys and they are not recognized as well.

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

Robert Ungemach

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….

Robert Ungemach

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.

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



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.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?