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
feita há 9 meses213 visualizações
1 Resposta
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
ESPECIALISTA
respondido há 9 meses
profile picture
ESPECIALISTA
avaliado há 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.

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas