It is the simple stuff that you expect to be, well, simple. Until they aren’t.

So the situation is like this:

  • I have an aws s3 bucket
  • I have multiple dynamically created consumers for objectCreated event from this bucket
  • Each consumer subscribes to specific prefix on this bucket. i.e. service 1 will listen to new files on srv1/ path only. service2 will listen to new files on srv2/ path only and so on.

Since one SNS cannot differentiate between s3 prefixes, I need to have multiple SNS topics — one for each service

Doing it manually — it is super easy, just create another pair of sns/sqs and I’m ready to go. But manual process belongs to the dark ages of 1995, I need to do it automatically using IaaC, Terraform in this case.

#terraform #aws #sns #s3

Dynamic AWS S3 Notification Configuration using Terraform
1.15 GEEK