send file server1 ←→server2

server to local

scp -i "k8s-key.pem" ubuntu@ec2-52-87-55-172.compute-1.amazonaws.com:/home/ubuntu/demo /home/ubuntu

send history from server to local

local to server

Send file from one server(ec2) to another server(ec2)

steps:-

first we need to connect both(ec2) server using pem file

  1. make sure both server have same key(pem file)

  2. copy pem file in one server. (like we do in our local server)

  3. give the permission chmod 400 chmod 400 "k8s-key.pem"

  4. if we want to connect another sever(ec2) then we need to ssh cmd.

  5. if we need here only teransfer the file then we don't need ssh.

command send file from one server to another :-

scp -i <pem_file_name> <file_name> ubuntu@<destination_ip>:<destination_location>

example:- scp -i k8s-key.pem file.txt ubuntu@52.87.55.172:/home/ubuntu