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
preguntada hace 9 meses213 visualizaciones
1 Respuesta
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
EXPERTO
respondido hace 9 meses
profile picture
EXPERTO
revisado hace 9 meses
  • 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.

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas