Two possibilities I can think of, although they are both mentioned in the link you referenced:
You are not mentioning the correct SSH keypair file or user name in the ssh command you’re using log into the server::
ssh -i [full/path/to/keypairfile] root@[ec2-instance-dns-name or ip-address]
You might not have the proper permissions to read from the keypair file.
chmod 600 [keypair-file]
Also, try with -v option with ssh to receive more insights on how it is failing.
If everything is set up properly, this will be the output you will be seeing.
debug1: Authentications that can continue: publickey,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Trying private key: ec2-keypair
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Just try using -i to list all the problems. And also use the complete path to eliminate all path problems.