AWS Lambda: how to add S3Event trigger?

0

I have a AWS Lambda NET 6 function. It was created in VS2022 with template using 2 entry points

LambdaEntryPoint LocalEntryPoint to run in AWS or in a local environment.

How can I add S3 Event trigger to the lambda?

  • Hello Oleg. Are you using CDK or CloudFormation to create your S3 bucket? Or is it an existing one that you only want to add an event to trigger the Lambda function?

  • Our legacy app stores files on local/network disk. By design my Lambda should create buckets with files. It is something like user deal1\file101 user deal1\file102, user deal2\file201 etc. I.e. user uploads files and in that moment the lambda should create buckets &|| file.

Oleg
已提問 9 個月前檢視次數 213 次
1 個回答
1

Hi Oleg.

Here is the documentation to trigger a Lambda function from an S3 bucket in response to an event. Here is some more.

The steps are:

  • Define which type of event you want to respond to in S3.
  • Grant the required permissions.
  • Enable notifications in the S3 console.
  • Configuring Lambda.
  • Testing.

I hope this helps.

profile pictureAWS
專家
已回答 9 個月前
profile picture
專家
已審閱 9 個月前
  • Ok, thank you. But what changes should I do in the LambdaEntryPoint ?

  • The only change is handling the event information (JSON document) that is passed to the Lambda function so it knows what event is about, and the object details. The event information is typically the first parameter in the function's entry point.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南