How to upload local system files to Amazon EC2 using ssh?

13,676

**Transferring Files between your laptop and Amazon instance ** For linux/Unix/Mac system, we can use a command-line tool “scp” to transfer files between your laptop and Amazon instance. Also we can use a GUI tool “FileZilla” to do the transfer, which is more user-friendly.

Using scp to transfer data “scp” means “secure copy”, which can copy files between computers on a network. You can use this tool in a Terminal on a Unix/Linux/Mac system.

To upload a file from your laptop to Amazon instance:

$scp -i ~/Desktop/amazon.pem ~/Desktop/MS115.fa  [email protected]:~/data/

This command will upload a file - MS115.fa in your ~/Desktop/ folder of your laptop to folder ~/data/ on an Amazon instance. Note you still need to use the private key you used to connect to the Amazon instance with ssh. (In this example, it is the amazon.pem file in ~/Desktop/.

Note: You need to make sure that the user “ubuntu” has the permission to write in the target directory. In this example, if ~/data/ was created by user “ubuntu”, it should be fine.

Similarly, to download a file from Amazon instance to your laptop:

$scp -i ~/Desktop/amazon.pem [email protected]:/data/ecoli_ref-5m-trim.fastq.gz ~/Download/

This command will download a file /data/ecoli_ref-5m-trim.fastq.gz from Amazon instance to your ~/Download folder in your laptop.

Note: You can use asterisk(*) to download multiple files, like *.fasta.gz.

Also you can follow the GUI tool "File Zilla" to perform the same task. To using File Zilla please follow the attached link:

http://angus.readthedocs.org/en/2014/amazon/transfer-files-between-instance.html

Share:
13,676
shekhardtu
Author by

shekhardtu

By Day: A usual guy with unusual job timing :p By Nights: Eat... Sleep... Code... Eat... Sleep For Fun: Quora, Tinder, nearbuy and Foosball

Updated on June 09, 2022

Comments

  • shekhardtu
    shekhardtu almost 2 years

    I have taken a free account of EC2 and setup LAMP on it, since my website was hosted on godaddy and its have a heavy chunk of data. Is there any way that I can transfer my files directly from godaddy or upload code from my local system?