简体   繁体   English

Python 脚本将文件从 ec2 windows 实例复制到 ec2 linux 实例

[英]Python script to copy files from ec2 windows instance to ec2 linux instance

I have a requirement where I need to create and schedule a python script to copy a few files from windows ec2 instance to linux ec2 instance once the instances are provisioned.我有一个要求,我需要创建和安排 python 脚本,以便在供应实例后将一些文件从 windows ec2 实例复制到 linux ec2 实例。

Can you please advice how to accomplish this?你能建议如何做到这一点吗?

Amazon EC2 instances are just like normal computers. Amazon EC2 实例就像普通计算机一样。 So, if you had a Windows computer on your desk and a Linux computer beside it, think about how you would copy files between the two computers and you can do the same thing with Amazon EC2.因此,如果您的办公桌上有一台 Windows 计算机和一台 Linux 计算机,请考虑如何在两台计算机之间复制文件,并且您可以使用 Amazon EC2 做同样的事情。

Frankly, sending files 'to' a computer can be quite difficult due to security limitations and having to have some way of 'sharing' file systems, such as sharing a network drive.坦率地说,由于安全限制和必须有某种“共享”文件系统的方式(例如共享网络驱动器),将文件“发送到”计算机可能非常困难。

A much easier way would be to have the Windows instance copy the files to an Amazon S3 bucket , and then have the Linux instance download the files from S3 .更简单的方法是让 Windows 实例将文件复制到 Amazon S3 存储桶,然后让 Linux 实例从 S3 下载文件 You can easily copy the files by using the AWS Command-Line Interface (CLI) .您可以使用AWS 命令行界面 (CLI)轻松复制文件。

This method avoids all the problems with security, sharing protocols and coping with different operating systems.这种方法避免了安全性、共享协议和应对不同操作系统的所有问题。

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

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