I have a hashicorp consul cluster that is in a private subnet on ec2. I want to access the consul web ui.
I added my key for ssh forwarding as:
ssh-add -k <my_private_key>.pem
I am able to use the following to log into my machines
ssh -A ubuntu@<bastionIP>
However when I try the following command for tunneling:
ssh -i <private_key>.pem -L 8500:10.0.31.163:8500 ec2-user@<bastion_public_IP>
I get the following error
Permission denied (publickey)
the ssh -vvv
option output can be found here (IPs obfuscated):
https://paste.ubuntu.com/25405193/
Thanks for your help!
Remove any other ec2 private key that is already added in your system.
Then remove rm -f ~/.ssh/known_hosts
then try to connect with running ssh ec2-user@host