I am able to connect to my EC2 instance from the terminal by using the SSH with public IP. But I am not able to login to it from another EC2 instance. I am using a key pair to login. When I try to do that I am getting
'Permission denied (publickey)'
I was expecting it would log in to the instance from another one using password authentication but it never asked for it. Just got denied with the 'Permission denied (publickey)' message. I want to login from one instance to another with password verification. I am on MAC and using the Ubuntu Machine
When connecting to a computer using SSH, you specify a private keypair:
ssh -i keypair.pem ec2-user@IP-ADDRESS
This still applies when you connect from one EC2 instance to another. You'll need to supply the private keypair to authenticate.
Therefore, you should copy the private keypair from your computer to the first instance and then provide that keypair when connecting to the second instance.