简体   繁体   English

放大用于存储的 s3 触发器

[英]Amplify s3 trigger for storage

i have crated an amplify react app with a storage where i can save my pdf file, i have create a trigger from the aws interface, but when i load a file my app don't trigger the lambda function. i load all file in a public folder of my storage and if i go in my storage properties i have the event event .我已经创建了一个带有存储空间的放大反应应用程序,我可以在其中保存我的 pdf 文件,我已经从 aws 界面创建了一个触发器,但是当我加载一个文件时,我的应用程序不会触发 lambda function。我将所有文件加载到一个我存储的公用文件夹,如果我的存储属性中有 go,我有事件事件 when i try the function manualy i have the event in cloudwatch but when i insert a document in my s3 bucket no.当我手动尝试 function 时,我在 cloudwatch 中有事件,但是当我在我的 s3 存储桶中插入文档时,没有。 where is the problem?问题出在哪儿? Where am I doing wrong?我哪里做错了? this is my trigger trigger and this is my function lambda code thanks for help这是我的触发器触发器这是我的 function lambda 代码谢谢你的帮助

i try to retrive pdf file when is load in a s3 bucket当加载到 s3 存储桶中时,我尝试检索 pdf 文件

You created the trigger "from the aws interface".您“从 aws 界面”创建了触发器。 I don't believe "Amplify Studio" supports that yet, and you should never make changes to Amplify generated resources via the "AWS Console" web interface.我认为“Amplify Studio”尚不支持,您永远不应通过“AWS 控制台”web 界面对 Amplify 生成的资源进行更改。

You should probably undo whatever you setup, and then do an amplify push from within your project to make sure it still deploys.您可能应该撤消您设置的任何内容,然后从您的项目中进行amplify push以确保它仍然可以部署。

If your S3 bucket (Storage) is managed by Amplify, and your Lambda (Function) is managed by Amplify, then you can easily generate a trigger that will activate the Lambda when changes occur in the S3 bucket.如果您的 S3 存储桶(存储)由 Amplify 管理,而您的 Lambda(功能)由 Amplify 管理,那么您可以轻松生成一个触发器,当 S3 存储桶发生变化时,该触发器将激活 Lambda。

From Amplify trigger documentation , you add the trigger from the S3 bucket:Amplify 触发器文档中,您从 S3 存储桶添加触发器:

amplify update storage

Then然后

? Do you want to add a Lambda Trigger for your S3 Bucket? Yes
? Select from the following options
❯ Choose an existing function from the project
  Create a new function

After those steps, deploy your changes:在这些步骤之后,部署您的更改:

amplify push

Then go ahead and drop a test file into your S3 bucket.然后拨打 go 并将测试文件放入您的 S3 存储桶中。

Your lambda will receive all S3 events for the bucket .您的 lambda 将接收存储桶的所有 S3 事件 Your code probably only wants to process the s3:ObjectCreated events.您的代码可能只想处理s3:ObjectCreated事件。

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

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