amazon-web-services - 如何在 serverless / cloudformation 中为合作伙伴事件总线创建事件规则
问题描述
我正在尝试为合作伙伴事件总线创建事件规则,arn:aws:events:{region}:{accountId}:event-bus/aws.partner/appflow/salesforce.com/{accountId}
即将所有事件发送到无服务器中的 SQS 队列但运气不佳,我一直遇到此错误:
Serverless Error ----------------------------------------
An error occurred: SFSubscriptionPartnerEventsRule - EventBus name starting with 'aws.' is not valid. (Service: AmazonCloudWatchEvents; Status Code: 400; Error Code: ValidationException; Request ID: ; Proxy: null).
对于上下文,合作伙伴事件总线名称是在创建 appflow 时自动生成的,因此无法aws
在名称中避免。
我可以通过 AWS 控制台arn:aws:events:{region}:{accountId}:rule/aws.partner/appflow/salesforce.com/{accountId}/myPartnerEventRule1
创建它,但真的很难通过无服务器 / cloudformation 创建它。
这是cloudformation的相关部分:
Type: AWS::Events::Rule
Properties:
Description: 'write salesforce subscription event to sqs'
Name: 'events-${self:custom.deployingStage}-sfsubscriptionevent-sfsubscriptionsqs'
EventBusName:
Fn::GetAtt:
- CustomerPlatformSFPartnerEventBus
- Arn
EventPattern:
account:
- Ref: 'AWS::AccountId'
State: ENABLED
Targets:
- Arn:
Fn::GetAtt:
- SFSubscriptionToCustomerPlatformQueue
- Arn
Id: '${self:custom.queue.sfSubscriptionToCustomerPlatformQueue}'
尝试了几件事无济于事:
- 将无服务器更新到最新版本 2.51
- 我想知道您是否将事件规则创建为 appflow 定义 AWS::AppFlow::Flow 的一部分,但在文档中找不到任何内容;也许我是盲人。
Fn::ImportValue: 'DefaultEventBusARN-${self:custom.deployingStage}'
如果我将 EventBusName: 值更改为它部署好的非合作伙伴事件总线,则“排除”其他任何内容。但我想要合作伙伴事件总线上的规则。
有任何想法吗?
解决方案
所以这也是我偶然发现的 AWS Cloudformation 中的一个错误。我联系了 AWS Support,得到了一些帮助(案例 ID 9092652141)。
这就是他们对这个问题所说的
对于此问题可能给您带来的任何不便,我深表歉意,我想通知您,我已就此行为与内部团队联系并要求调查此问题。
但是,在他们自己的环境中复制问题后,他们还提供了临时解决方法。
不要使用 Arn 或复制粘贴事件总线的名称,而是添加对事件总线名称的引用。我昨天尝试了这种方法,并成功创建了事件总线和规则。
话虽如此,至于现在为了创建事件规则,我会要求您传递事件总线的名称而不是 Arn。
Resources:
EventBus:
Type: AWS::Events::EventBus
Properties:
EventSourceName: <copy-paste the event source name of the partner here>
Name: <Same as above>
EventRule:
Type: AWS::Events::Rule
Properties:
Name: <Event rule name>
EventBusName: !GetAtt EventBus.Name
推荐阅读
- spring-boot - GitHub Action Gradle buildBootImage
- api - 如何使用 HubSpot 的 CRM API 访问/检索通过搜索查询返回的“交易”对象的“所有者”对象或“所有者 ID”属性?
- jira - Jira Zephyr 与 Webdriver IO 的集成
- python - python中KNN的数据预处理
- optimization - 根据多次转化计算转化“权重”
- javascript - 按钮事件仅选择第一类。(jQuery)
- reactjs - 在 React 中使用通用组件
- python - 用于修改新文件并将修改后的文件添加到另一个目录的 AWS Lambda 函数
- python - 使用 cx_freeze 创建 .msi 时包括 Ghostscript
- python - 数据库表未填充数据(MySQL 连接器/Python)