Connect to private EC2 via public EC2

Connections to a private EC2 instance can be made via a public EC2 instance.

Having set up putty as in the previous 2 posts we need to load the keys onto the public instance to enable connection to the private instance.

Connect to the public EC2 instance

Change directory into “.ssh” e.g. cd ~/.ssh

Copy the devopsdba2.pem file to this location.


Edit the devopsdba2.pem file on your PC using notepad, select All and Copy

Edit the file on the EC2 instance (vi devopsdba2.pem”), paste the contents of your buffer there and then exit. Change the protection on this file to 400 “chmod 400 devopsdba2.pem”

Connect to the private instance

ssh -i ~/.ssh/devopsdba2.pem

Check that the prompt now contains the new hostname.