简体   繁体   English

在ec2上从ipython访问本地文件

[英]Access local file from ipython on ec2

I am using an ipython notebook on an ec2 instance. 我在ec2实例上使用了ipython笔记本。 I want to read a file sitting on my local machine. 我想读取本地计算机上的文件。 Is that possible, or should I push the file onto the ec2 box (eg via an s3 mount) 有可能吗,还是应该将文件推送到ec2框上(例如通过s3挂载)

Just to clarify... It sounds like you have connected to an Amazon EC2 Linux instance via SSH and you are using iPython Notebook on that instance. 只是澄清一下……听起来您已通过SSH连接到Amazon EC2 Linux实例,并且您正在该实例上使用iPython Notebook。 You would like Python to access a file on your local computer (from which you initiated the SSH session). 您希望Python访问本地计算机上的文件(从该文件启动SSH会话)。

Is this correct? 这个对吗?

This is not possible through a standard SSH session. 通过标准的SSH会话是不可能的。 No disks are shared across SSH. 没有磁盘在SSH之间共享。

You could use scp from your local computer to copy a file to the remote Linux instance. 您可以使用本地计算机上的scp将文件复制到远程Linux实例。

Alternatively, you could copy files via Amazon S3. 或者,您可以通过Amazon S3复制文件。 Install the AWS Command-Line Interface (CLI) on your local computer, then use the aws s3 cp command to copy the file to S3. 在本地计算机上安装AWS命令行界面(CLI) ,然后使用aws s3 cp命令将文件复制到S3。 Then, use the same command to copy the file from S3 to your EC2 instance (effectively using S3 as a central file repository). 然后,使用相同的命令将文件从S3复制到您的EC2实例(有效地使用S3作为中央文件存储库)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM