How To Transfer Files To EC2 Server/Linux Host

Umar Ashfaq
Eastros
Published in
1 min readApr 19, 2012

You can transfer file to an EC2/Linux host via SCP. For that you first need to have the private key file downloaded on your system. Once you have it, open the terminal window and issue the following command.

scp -i mykey.pem somefile.txt ec2-user@ec2-123-45-67-89.compute-1.amazonaws.com:/home/files

For simple Linux host, you may not need to provide the .pem file, instead issue the following command.

scp somefile.txt root@ec2-123-45-67-89.compute-1.amazonaws.com:/home/files

Hit return and provide the password for root user.

mykey.pem: Private key generated and downloaded through Amazon EC2.

somefile.txt: File that is to be transfered.

ec2-user: EC2 instance user which is created by default

ec2–123–45–67–89.compute-1.amazonaws.com: EC2 public DNS

/home/files: Location on EC2 server where somefile.txt will be saved

--

--