监听 AWS S3 存储桶上传文件时。

huangapple go评论94阅读模式
英文:

Listen to aws s3 bucket when upload file

问题

我有一个问题,我需要知道是否有人有解决方法...
我需要创建一个东西,可以监听S3存储桶,当有文件上传时,实际上获取他们上传的文件,并在我的网站上使用我已经拥有的各种流程对其进行处理。

所以基本上,是否有类似的东西可以让我监听在S3中已经上传的文件,然后进行操作?

谢谢

英文:

I have a problem that I need to know if anyone has an idea how to solve it..
I need to create something that listens to the s3 bucket when a file is uploaded there and actually take the file they uploaded and manipulate it in my website with all kinds of processes that I already have

So basically, is there something like this that lets me listen to uploads that have been made in s3 and then manipulate it?

Thank you

答案1

得分: 1

有许多方法可以实现这个目标。
首先启用 S3通知,将在 s3 PutObject 上触发,然后触发以下任一操作 -

  • Lambda - 获取对象并处理(不适用于大文件,Lambda 可以运行 15 分钟)
  • 将新对象通知放入 SQS 队列。然后启动 ec2 实例 来处理文件。您可以使用 autoscalingcloudwatch alarm。获取一些想法 从这里
    或者其他方法。

我的建议是这样的 -

s3 通知 -> 触发 Lambda -> 获取对象键并运行 ec2 实例 -> ec2 执行艰苦的工作

> 没有完美的想法,这高度取决于您的系统。寻找更适合您需求的更好解决方案。

最好的祝愿。

英文:

There are many ways to achieve this.
First enable S3 Notification that will be triggered on s3 PutObject, and trigger any of these -

  • Lambda - gets the object and processes (not for large files, lambda can run for 15 mint)
  • put new object notifications in a SQS queue. Then launch ec2 instances to process the files. You can use autoscaling and cloudwatch alarm with it. Get some ideas from here.
    Or some more.

My suggestion would be this -

s3 notification -> Trigger Lambda -> get object key and run ec2 instance -> ec2 does the hard work

> No ideas are perfect, it highly depends on your system. Look for better solution that meets your need.

Best wishes.

huangapple
  • 本文由 发表于 2023年1月9日 15:04:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/75054051.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定