如何使用ssh将本地系统文件上传到Amazon EC2? [英] How to upload local system files to Amazon EC2 using ssh?
问题描述
自从我的网站托管在godaddy上以来,我就免费使用了EC2并在其上设置了LAMP,并且其中包含大量数据。有什么方法可以直接从Godaddy传输文件或从本地系统上传代码?
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?
推荐答案
**传输文件在笔记本电脑和Amazon实例之间
**
对于linux / Unix / Mac系统,我们可以使用命令行工具 scp在笔记本电脑和Amazon实例之间传输文件。同样,我们也可以使用GUI工具 FileZilla进行传输,这更加用户友好。
**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.
使用scp传输数据
scp表示安全复制,可以在网络上的计算机之间复制文件。您可以在Unix / Linux / Mac系统上的终端中使用此工具。
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.
要将文件从笔记本电脑上传到Amazon实例:
To upload a file from your laptop to Amazon instance:
$scp -i ~/Desktop/amazon.pem ~/Desktop/MS115.fa ubuntu@ec2-54-166-128-20.compute-1.amazonaws.com:~/data/
此命令将上传文件-MS115.fa笔记本电脑的〜/ Desktop /文件夹到Amazon实例上的〜/ data /文件夹。请注意,您仍然需要使用用于通过ssh连接到Amazon实例的私钥。 (在此示例中,它是〜/ Desktop /中的amazon.pem文件。
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/.
注意:您需要确保用户 ubuntu具有以下权限:
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.
类似地,要从目标目录中下载文件,则应使用〜/ data /。笔记本电脑上的Amazon实例:
Similarly, to download a file from Amazon instance to your laptop:
$scp -i ~/Desktop/amazon.pem ubuntu@ec2-54-166-128-20.compute-1.amazonaws.com:/data/ecoli_ref-5m-trim.fastq.gz ~/Download/
此命令将从Amazon实例下载文件/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.
注意:您可以使用星号(*)下载多个文件,例如* .fasta.gz。
Note: You can use asterisk(*) to download multiple files, like *.fasta.gz.
此外,您还可以按照GUI工具 File Zilla进行操作
要使用File Zilla,请点击附件链接:
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
这篇关于如何使用ssh将本地系统文件上传到Amazon EC2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!