Ravi Sir's Cards › AWS
Avoid recursive S3 events
This revision card explains Avoid recursive S3 events. If Lambda writes a thumb into the same prefix it listens on, every write fires another invoke forever. It describes guard — only process keys under uploads/ (or skip any key starting with thumbs/). Write thumbs elsewhere. The how-to section notes event notification prefix uploads/. In code — if key.startswith("thumbs/"): return. Dest prefix THUMB_PREFIX=thumbs/. An example on the card is one upload creates exactly one thumb and one DynamoDB row — CloudWatch shows a single invoke.
Read card text
What this card says
Why do we need it?
If Lambda writes a thumb into the same prefix it listens on, every write fires another invoke forever.
What is it?
Guard: only process keys under uploads/ (or skip any key starting with thumbs/). Write thumbs elsewhere.
How to do it
Event notification prefix uploads/. In code: if key.startswith("thumbs/"): return. Dest prefix THUMB_PREFIX=thumbs/.
thumbs/
Example
One upload creates exactly one thumb and one DynamoDB row — CloudWatch shows a single invoke.