0

I am setting up a backup server instance on EC2 with a public dns for its IP so that other servers on hostgator with dedicated IPs can send files to it.

I am confused as to how to use SCP with EC2 and the other questions on here regarding this subject confused me as they seemed to be trying for a different approach.

Would this simply work, or do I have to direct the EC2 instance to its keypair as an argument?

$ scp username@hostgatorip:/home/username/file.txt username2@ec2publicdns:/home/username2/

Thank you!

user1062058
  • 505
  • 2
  • 10
  • 17
  • scp uses the SSH protocol - you must pass the same credentials to it as you would to SSH into your instance. EC2 instances are usually setup to allow only certificate based access. Unless you have changed that, you must pass the keypair as an argument (i.e. `scp -i /path/to/keypair.pem /path/to/local_file ec2-user@xxx.xxx.xxx.xxx:/remote/path/`) – cyberx86 Dec 21 '11 at 19:47
  • I see, that makes sense. Also, you can put your comment as an answer. – user1062058 Dec 21 '11 at 19:51

1 Answers1

2

It will work but if you use the -3 switch then the data won't travel through your own macine. Without the -3 option all data will go through your machine.

Or you can ssh into one of your server and scp local data to your another machine.

It will ask you password if you don't add your public key to the server's authorized_keys.

Stone
  • 7,011
  • 1
  • 21
  • 33