amazon-web-servicesfilteraws-event-bridge

AWS EventBridge on-the-fly filter update


I want to use the EventBridge filter to control data processing enabled by subscription. For example, I have say 5 customers: A-E. Only B and D have a subscription so I want to only process event payloads coming from customers B and D.

If the subscriber list changes, say by adding customer E, I need to update the EB filter so it is filtering for B, D, & E.

What's the best way to do that on-the-fly so that a subscriber change event triggers a change in the EB filter?


Solution

  • Ok, here's what I have learned. There are 2 ways to update an EventBridge (EB) filter (aka Rule or Pattern):

    1. use TS/CDK to execute a CLI "update-stack" command OR
    2. execute a PutRuleCommand via TS

    The preferred option depends on whether you are concerned about stack drift. In my case, that's not an issue.

    PutRuleCommand will perform the update faster than using TS/CDK to execute a CLI "update-stack", since it doesn't involve the whole stack. However, the change still isn't instantaneous.