Ravi Sir's Cards › AWS
Order fan-out with SNS+SQS
This revision card explains Order fan-out with SNS+SQS. It starts from the need that one Swiggy-style order must notify email and inventory at the same time without coupling those teams. It describes API , then Lambda , then SNS topic , then two SQS subscriptions (email-q, inventory-q) , then each queue has its own Lambda , then DynamoDB writes. The how-to section covers how to create topic, two queues, subscribe each queue to the topic, two worker roles, intake Publish, POST /orders. An example on the card is one POST creates two DynamoDB trails (email-sent row and inventory-reserved row) from separate workers.
Read card text
What this card says
Why do we need it?
One Swiggy-style order must notify email and inventory at the same time without coupling those teams.
What is it?
API → Lambda → SNS topic → two SQS subscriptions (email-q, inventory-q) → each queue has its own Lambda → DynamoDB writes.
How to do it
Create topic, two queues, subscribe each queue to the topic, two worker roles, intake Publish, POST /orders.
SNS → SQS
Example
One POST creates two DynamoDB trails (email-sent row and inventory-reserved row) from separate workers.