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
make sure both server have same key(pem file)
copy pem file in one server. (like we do in our local server)
give the permission chmod 400
chmod 400 "k8s-key.pem"
if we want to connect another sever(ec2) then we need to ssh cmd.
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