I have 2 instances in AWS. One of them in a public subnet (bastion), the second one in a private subnet.
Both of them were launched with the same key pair (.pem file).
This is how I connect to the bastion:
ssh -i secret.pem ec2-user@public-ip
Works great, I am in.
Now, I want to ssh the instance in a private subnet. Googling says that I should forward the agent:
ssh -A ubuntu@private-ip
But unfortunately I get the error:
Permission denied (publickey).
Can someone please explain what I am doing wrong and how to ssh the private instance? (ping and security groups are ok)