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!

link|improve this question

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
feedback

1 Answer

up vote 2 down vote accepted

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.

link|improve this answer
Thanks for the reply, how do I add the -3, as an argument? so scp -i -3 ... ? – user1062058 Dec 21 '11 at 19:52
Yes, but before -i because -i has a file parameter. – Stone Dec 21 '11 at 20:13
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.