gpt4 book ai didi

amazon-web-services - aws.events 的 EventBridge 规则问题

转载 作者:行者123 更新时间:2023-12-04 07:38:22 28 4
gpt4 key购买 nike

我想将发送到自定义事件总线的所有事件发送到 CloudWatch 日志。
我创建了自定义事件总线:my-event-bus我创建了 CloudWatch 日志组
我创建了事件总线策略,以便我帐户中的每个人都可以将事件放入 my-event-bus我为那个自定义总线创建了一个规则
这是规则:

  MyRuleForBus:
Type: AWS::Events::Rule
Properties:
Description: Testing rule
EventBusName:
Name: testing-rule-for-my-event-bus
EventPattern:
source:
- aws.events
State: ENABLED
Targets:
- Arn: arn:aws:logs:us-east-1:MY_ACCOUNT_ID:log-group:my-event-bus-log-group
Id: 'my-bus'
当我尝试放置一个事件时 aws events put-events --entries file://put-events.json我收到以下错误
{
"FailedEntryCount": 1,
"Entries": [
{
"ErrorCode": "NotAuthorizedForSourceException",
"ErrorMessage": "Not authorized for the source."
}
]
}

这是 put-events.json的内容
[
{
"Source": "aws.events",
"EventBusName": "my-event-bus",
"Detail": "{ \"key1\": \"value3\", \"key2\": \"value4\" }",
"Resources": [
"resource1",
"resource2"
],
"DetailType": "myDetailType"
}
]
但是,如果我将源更改为其他,例如,'hello',则在规则和事件中都有效。
我究竟做错了什么?
我想让它与 aws.events 一起工作所以发送到该总线的所有事件都在 CloudWatch(目标)中结束

最佳答案

aws.events 属于 AWS , 不是给你的,因此你不能把它定义为你的事件的来源。只有 AWS 可以做到。
您需要使用自己的自定义名称 对于您的事件的来源,例如myapp.events .

关于amazon-web-services - aws.events 的 EventBridge 规则问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67629258/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com