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
posta 9 mesi fa211 visualizzazioni
1 Risposta
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
ESPERTO
con risposta 9 mesi fa
profile picture
ESPERTO
verificato 9 mesi fa
  • 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.

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande