I'm relatively new to AWS. I'm working with what I think is a common pattern:
- Put file in S3 bucket
- Do something with said file in Lambda function
I see two options for making this link (ignoring SNS):
- invoke the lambda when an S3 event occurs
- send the S3 event to an SQS queue, which in turn triggers the lambda
It won't be handling a huge number of events to begin with, but the hope is to hook up a lot more buckets to this lambda in the future. Immediate invocation, message ordering, and speed/time is not of critical importance. However retries, capturing files that "fail", DLQs, and all that good stuff is important.
I'm leaning towards the SQS route. I think it fits better with my requirements, it's the one I've managed to make a working terraform module for, and I don't think it will add to my bill in any significant way.
Is this a matter of opinion or is there an objectively better option here?
Best Answer
I think the most robust approach is
SNS gives you that pub sub endpoint so you can attach more things to the event if required.
SQS gives you the error handling and guaranteed delivery
However, there are reliability options with all combinations of choices. You would really need to have very specific requirements in order to say one way is the right way for you.