I took a slightly different approach which may be useful for others.
To avoid editing the public key when importing into AWS, those commands worked for me when generating the key pair:
Private key creation:
openssl genpkey -algorithm RSA -out MyKey.pem -pkeyopt rsa_keygen_bits:2048
chmod 400 MyKey.pem
Public key creation:
ssh-keygen -y -f MyKey.pem > MyKey.pub
Now import MyKey.pub as is into AWS.