简体   繁体   English

Aws s3 在非临时文件的新文件上触发 lambda

[英]Aws s3 trigger lambda on new files that are NOT temporary files

i want to launch a lambda for any new complete file, the process is quite simple:我想为任何新的完整文件启动 lambda,过程非常简单:

  1. i upload files to s3我将文件上传到 s3
  2. for every new files in the directory I launch a lambda对于目录中的每个新文件,我都会启动一个 lambda

unfortunately, i see that my lambdas invokes on _temporary/* files, which are files that are not fully uploaded to s3.不幸的是,我看到我的 lambdas 调用了 _temporary/* 文件,这些文件没有完全上传到 s3。 what can i do?我能做什么?

thanks!谢谢!

There is no concept of a "partially uploaded" file in Amazon S3. Amazon S3 中没有“部分上传”文件的概念。 Either the whole object is created, or the object is not created.要么创建整个对象,要么创建对象。 Nor does Amazon S3 have a concept of "temporary" or _temporary/ files. Amazon S3 也没有“临时”或_temporary/文件的概念。 If they exist, it is because your application is uploading those files.如果它们存在,那是因为您的应用程序正在上传这些文件。

When creating an Amazon S3 event, you can specify a Prefix .创建 Amazon S3 事件时,您可以指定Prefix The event will only be triggered for objects matching that prefix.只有匹配该前缀的对象才会触发该事件。

Alternatively, you could add a line of code at the start of the AWS Lambda function that checks the Key of the object and exits if it does not need to perform any actions on the object.或者,您可以在 AWS Lambda 函数的开头添加一行代码,用于检查对象的 Key 并在不需要对对象执行任何操作时退出。

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

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