我想根据不同的规则触发单个 lambda。我可以在 lambda 上设置多个事件规则吗?类似于以下内容:
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
我发现这个https://www.serverless.com/framework/docs/providers/aws/events/event-bridge/ 似乎表明它是可能的,但我似乎无法让它工作。
我收到以下错误:
Failed to create resource. The statement id (mylambda-mylambda-rule) provided already exists. Please provide a new statement id, or remove the existing statement.