I have created two EC2 instances on AWS. I created a key pair for each of them. I downloaded the .pem private keys and converted them into .ppk
format. I can connect to each of my ec2 instances using PuTTY and their .ppk private key. But how do I SSH from one of my ec2 instance to the other? I can ping the Public DNS of either of them from the other. But if I try ssh from one to the other, I get:
Permission denied (publickey).
Best Answer
Method 1 - use the same keys on the servers:
Convert the keys to openssh format and upload the private keys to the servers. When you ssh to the destination host, specify the private key file:
Method 2 - Create new keys
On each server run:
Hit enter enter enter. You'll have two files:
On Server A, cat and copy to clipboard the public key:
ssh into Server B, and append the contents of that to the it's authorized_keys file:
Now ssh from server A: