简体   繁体   中英

Send Files to EC2 from S3 - AWS

I have a mp4 file in my S3 bucket root. I just need to send that file to the "Downloads" tab in the EC2 Windows instance that I have and I need to do this by Lambda (Python).

Could you please tell me how to do this? Thanks in Advance.

An Amazon EC2 instance is a computer just like any other computer -- it runs Windows or Linux just like normal.

So, ask yourself "How would I copy a file to a Windows/Linux computer"?

By default, computers don't get 'sent' files. You would need to interface with some software running on the Operating System, such as a web server, FTP server, or a shared drive across the network.

If it is a Linux system, you could find a Python library that does SCP (eg Paramiko, see: How to scp in Python? ) and somehow call that from Lambda.

However, the better way is not to send the file to the EC2 instance. Instead, have the EC2 instance retrieve the object from S3. A common method is to have S3 send a message to an Amazon SQS queue that a program on the EC2 instance monitors, and then the program can download the object. This is a much more 'secure' way to transfer the file, since the EC2 instance does not need to be open for inbound connections.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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