简体   繁体   English

不上传触发S3 Object

[英]Trigger S3 Object without upload

I have a feeling the answer to my question will be a correct google term that i am missing but here we go.我感觉我的问题的答案将是我所缺少的正确的谷歌术语,但在这里我们是 go。

I need to trigger all objects in an s3 bucket without uploading.我需要在不上传的情况下触发s3存储桶中的所有对象。 The reason being i have a lambda that gets triggered on PutObject and i want to reprocess all those files again.原因是我有一个在 PutObject 上触发的PutObject ,我想再次重新处理所有这些文件。 There are huge images and re-uploading does not sound like a good idea.图片很大,重新上传听起来不是个好主意。

I am trying to do this in nodejs but any language that anyone is comfortable with will help and i will translate.我正在尝试在nodejs中执行此操作,但任何人都熟悉的任何语言都会有所帮助,我会翻译。

Thanks谢谢

Amazon S3 Event can trigger an AWS Lambda function when an object is created/deleted/replicated.在创建/删除/复制 object 时,Amazon S3 事件可以触发 AWS Lambda function。

However, it is not possible to "trigger the object" -- the object would need to be created/deleted/replicated to cause the Amazon S3 Event to be generated.但是,不可能“触发对象”——需要创建/删除/复制 object 以导致生成 Amazon S3 事件。

As an alternative, you could create a small program that lists the objects in the bucket, and then directly invokes the AWS Lambda function, passing the object details in the event message to make it look like it came from Amazon S3.作为替代方案,您可以创建一个列出存储桶中对象的小程序,然后直接调用AWS Lambda function,传递 object event消息中的详细信息,使其看起来像来自 Amazon S3 的详细信息。 There is a sample S3 Event in the Lambda 'test' function -- you could copy this template and have your program insert the appropriate bucket and object key. Lambda 'test' function 中有一个示例 S3 事件——您可以复制此模板并让您的程序插入适当的存储桶和 object 密钥。 Your Lambda function would then process it exactly as if an S3 Event had triggered the function.然后,您的 Lambda function 将处理它,就像 S3 事件触发了 function 一样。

In addition to what explained above, you can use AWS S3 Batch Operations .除了上面解释的内容之外,您还可以使用AWS S3 Batch Operations We used this to encrypt existing objects in the S3 bucket which were not encrypted earlier.我们使用它来加密 S3 存储桶中先前未加密的现有对象。

This was the easiest out of the box solution available in the S3 console itself.这是 S3 控制台本身提供的最简单的开箱即用解决方案。

You could also loop through all objects in the bucket and add a tag.您还可以遍历存储桶中的所有对象并添加标签。 Next, adjust your trigger event to include tag changes.接下来,调整您的触发事件以包括标签更改。 Code sample in bash to follow after I test it. bash 中的代码示例在我测试后遵循。

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

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