2

I have a lambda that gets triggered when an object gets created in my s3 bucket. It adds metadata to the object and does some validation. In order to add the metadata I issue a copy request, and delete the old object.

But this creation also triggers my lambda. Is there any easy way around this?

user9910093
  • 119
  • 1
  • 12

1 Answers1

4

There are multiple events that can trigger Lambda from S3. When selecting your events from S3 choose the right one. See Image for details. enter image description here

Put and post will trigger lambda when the files get created. In Lambda call copy so that will not trigger the Lambda again. Problem Solved.

Otherwise, it will create a loop doing the same thing and your Lambda will throttle and cost you money.

johnny
  • 2,032
  • 1
  • 25
  • 45
  • 1
    It is important to note that you only get this sort of checkbox interface when creating the trigger from S3 console. There are far fewer options if trying to create the trigger from the lambda console. – RaGe Jun 15 '18 at 03:46
  • 1
    Rage! yes, that is true but you don't have to do it from Lambda console. You can do it with api call using sdk, s3 console or cli. Seems like Lambda console is a bit behind. – johnny Jun 15 '18 at 04:11