Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|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 – 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
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.

share|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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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