A couple of things here to remember - the default username is “fedora” and the key you used should be associated with that user. Are you logging in as fedora@<ec2 ip address>
$ ssh davdunc@0.235.145.67
davdunc@0.235.145.67: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
$ ssh fedora@0.235.145.67
Last login: Wed Jan 6 21:31:36 2021 from 0.121.188.74
I created this EC2 instance for testing purposes and I haven’t set any password.
Why does it try to connect with a password?
This is how I try to connect:
Ah. Amazon Linux 2 is a different operating system. It’s not published by the fedora team here. If you are using the Fedora AMI, then the default username is fedora. If you are using CentOS, the default name is centos Amazon recommends a standard username of ec2-user, but as a community, we don’t see that as the right option for our general purposes and want to remain consistent across all platforms. Amazon Linux is different in that it is purpose-built for Amazon EC2.
If you are still having difficulty logging into this or any other instance, you might want to verify the signature of the key you are using. Keep in mind that Amazon EC2 verifies by md5 hash and not by the default hash. You can follow the instructions provided by Amazon in the documentation linked here. If they match, then I would use a verbose logging for the ssh command to review all of the details