How to SSH between EC2 instances in the same subnet / availability zone

How to SSH between EC2 instances in the same subnet / availability zone

copy your *.pem file to a safe place – like maybe /home/ec2-user/.ssh
lets say your pem file is named – test.pem

chmod 600 /home/ec2-user/.ssh/test.pem
ssh -i /home/ec2-user/.ssh/test.pem hostname-you-want-to-ssh-to

# same goes for scp – just use the “-i pemfilename.pem” switch
# the easy way is use your “ec2-user”… if you try to use root – you are blocked by default and at that point you have to go thru hoops to circumvent security – easy way is sudo scp or just ssh from ec2-user.
If the pem file is on another computer – then open the pem file up with a text editor – nano – vi – notepad… and copy / put the entire key and begin and end statement in your paste buffer – logon to the computer that does not have the pem and create it / paste key into a file of the same name (name doesn’t matter that much – protection and the key inside do).
More from LonzoDB on AWS

Leave a Comment

Scroll to Top