SNS/SQS fanout with Terraform

With SNS you can easily publish an event and immediately deliver it to topic’s subscribers. With SQS you can decouple services and asynchronously process events. If you connect both services, you will get all benefits together.


Let’s create a SNS topic and two SQS queues.


Everything should be connected.


By default your topic cannot forward message to the queues. You need to add missing permissions to every queue as access policy.