Skip to main content

9 months ago

Problem in doing a ssh to a private instance from bastion host

I came across this issue when i was working on a lab-exercise. I am sure i have provided access to SG's NACL's and other configuration setting as well looks good. 

The issue that i see is only when i do a ssh to a private instance froma Bastion host. I was just prompted with the below error. 

Any suggestion or help on this woule really be  great. Thanks Again

[ec2-user@ip-10-0-1-175 ~]$ ssh ec2-user@
Permission denied (publickey).

Image of ermin
9 months ago

Try it like this "ssh -i /path/to/the/key/file  ec2-user@" maybe you are using a  wrong key file.

Image of adriancantrill
9 months ago
Is this the lesson where you SSH from your machine into the bastion and then form that into the private instance? If so, are you running macOS/Linux? did you SSH into the bastion with '-A'? if you are running windows you need a few bits of config - check this link. You need the agent installed, and your key loaded into that, and then set putty to forward the auth. All explained in the link below.

Image of gaaneshh
9 months ago
Thanks   @adriancantrill    @ermin  for your inputs on this. Followed by this, i had a  similar practise lab to ssh from a bastion host to a private instance(connecting db instances). 

In this practise lab i had plenty of time left to play aorund and i identified what the problem was. Its the pem key that it is looking for in the bastion host. I somehow managed to ftp the pem key and connected (ssh'd)to the private instance from the Bastion host and that worked the way as expected.

Thanks again!!