Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle overlapping suffixes, prefix for s3 event notification

I have two AWS lambda functions which are processing all images uploaded to an S3 bucket(One is for creating thumbnail and another is for image moderation[rekognition]).

While I am doing it, I found it invalid to add event notifications with overlapping prefix and suffix.

For example, let's assume that I want to set the two event notification like the below.

event type: PUT | prefix: root | suffix: .jpg | send to: lambda-A
event type: PUT | prefix: root | suffix: .jpg | send to: lambda-B

# Error message: Cannot have overlapping suffixes in two rules if the prefixes are overlapping for the same event type.

If it is not available I think there must be a kind of pattern commonly used in this case(for instance, making a proxy lambda to call the two lambdas passing the same event notification.)

What is the best way to handle the case?

like image 901
SangminKim Avatar asked Oct 20 '25 02:10

SangminKim


1 Answers

AWS wrote an article entitled Fanout S3 Event Notifications to Multiple Endpoints. Options include:

  • SNS to multiple Lambdas
  • single master Lambda invoking fanout

The article was written before Step Functions, so if the processing required is moderately complex then you might also consider triggering Step Functions to drive multiple coordinated Lambda functions.

like image 106
jarmod Avatar answered Oct 21 '25 17:10

jarmod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!