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
asked 8 months ago204 views
1 Answer
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
EXPERT
answered 8 months ago
profile picture
EXPERT
reviewed 8 months ago
  • 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions