'Lambda returned payload, split in SNS and send individually to SQS
I have the following flow: Lambda -> SNS -> SQS.
The lambda returns an array of objects to process at the end of the function. Lambda is connected to SNS via async invocations.
This makes it into SNS as a single payload, but I want it to split up at this point and publish an individual message for each object to an SQS queue.
I'm configuring this using terraform's event_invoke_config.
What configuration is necessary to have a single payload returned in lambda to be split in SNS? Or, do I need to batch send using the aws-sdk programmatically in the lambda?
Solution 1:[1]
It would help to see the kind of data you're working with here (e.g. the array of objects).
I'd question what's the purpose of that. Having SNS in your architecture usually means you want to 'fan' out to multiple - different - subscribers.
If you want everything to go to the same SQS queue, why not keep the array together? Then just split it up in a receiving Lambda that's triggered off the SQS queue?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
