I'd like to trigger a single lambda based on different rules. Can I set multiple event rules on a lambda? Something like the following:
mylambda:
handler: lambdas/mylambda.handler
description: Reusable lambda
iamRoleStatements:
- Effect: Allow
Action:
- events:PutEvents
Resource:
- ${ssm:/foo/bar/myEventBus}
events:
- eventBridge:
eventBus: ${ssm:/foo/bar/myEventBusArn}
pattern:
source:
- foo
detail:
myKey:
- bar
- eventBridge:
eventBus: ${ssm:/foo/bar/myEventBusArn}
pattern:
source:
- baz
detail:
myKey:
- oof
I found this https://www.serverless.com/framework/docs/providers/aws/events/event-bridge/ which seems to indicate it's possible, but I can't seem to get it to work.
I get the following error:
Failed to create resource. The statement id (mylambda-mylambda-rule) provided already exists. Please provide a new statement id, or remove the existing statement.
Does not look like EventBridge supports multiple rules on a lambda. Unless someone knows different, but so far I have not found anything that indicates that's it's possible.