ssh connection between two EC2 instances and scp copy from local to EC2

Successful ssh connection between two EC2 .

Successful ansible connection to the hosts.

Steps:

Become ROOT for master and client

Ssh-keygen in master

cd /home/ubuntu/.ssh

do ssh-keygen

Cat id_rsa.pub

Copy the contents

Go to client, become root and go to /home/ubuntu/.ssh

vi authorized_keys

Paste the key in a new line.

Login to master and test the connection.

How you can test:

Go to the same path where you have the private key :

ssh -i id_rsa ubuntu@54.186.176.98<public-ip of the server>

3.Successful ssh connection in master:

For the same server, we used ansible connection = local

4.Secure copy file from local to AWS:

Go to the location where file is stored.

Scp -I <.pem key of amazon> filepath/filename ec2-user@<amaozon-hostname>:/home/ubuntu

————————————-