Connect to private EC2 instances via bastion hosts with SSH Agent forwarding

Updated: July 7, 2019
By László Bodor
Connect to private EC2 instances via bastion hosts with SSH Agent forwarding

To connect to a private EC2 instance you need to use a bastion host (oka jump box). But because of security concerns you might not want to upload your private key to the bastion host. How do you solve this dilemma ? Easy! With SSH Agent forwarding.

You can refer to the code snippet below or the video at the bottom of the article

`ssh-agent bash ssh-add keyfilename ssh -A USER@BASTIONHOST

ssh USER@PRIVATEIP `

The video below shows you how to do this quick and easy

Tags

agent forwarding aws bastion host EC2 jump box private instance private key SSH