Sometimes, the SSH key that you have or shared by another person may not be letting you in.
In such cases, we need to compare the fingerprint of the key with the one showing on your AWS console.
By running the following commands locally on a terminal, you will be able to see the fingerprint.
openssl pkcs8 -in keyname.pem -inform PEM -outform DER -topk8 -nocrypt | openssl sha1 -c
keyname.pem with your key file name on your local.
Compare the output shown on the terminal with the value showing on the AWS >> ec2>> Key Pairs section.
Please leave a comment below if this helped.