英文:
How can I send events to EventBridge upon AWS CloudWatch alarm status change?
问题
如何在警报状态更改时发送事件到EventBridge?
警报事件和EventBridge - 亚马逊云监控说这是可能的,但没有说明如何操作。
警报上可用的UI操作也不允许将EventBridge设置为操作。
我不想使用SNS。我需要通过EventBridge来触发特定操作。
英文:
How to send an Event to EventBridge on Alarm state change?
Alarm events and EventBridge - Amazon CloudWatch says it's possible but doesn't tell how to.
UI Actions available on alarm also doesn't let EventBridge to be set as an action.
I don't want to use SNS. I need to trigger specifically via EventBridge.
答案1
得分: 2
EventBridge
不能作为警报的目标。相反,EventBridge
是从AWS(以及可选地来自AWS合作伙伴和您的自定义事件)接收所有事件的总线。说到这一点,在将Cloudwatch
的警报传递到EventBridge
中,您需要执行以下步骤:
EventBridge
->Rules
->创建规则
在事件源
中选择AWS事件或EventBrige合作伙伴事件
在示例事件
中,您可以选择CloudWatch Alarm State Change
,以便查看可以用来过滤事件的完整值列表。
在事件模式
中,您将选择:
AWS服务
->CloudWatch
->CloudWatch Alarm State Change
这将创建一个类似于此的事件模式:
{
"source": ["aws.cloudwatch"],
"detail-type": ["CloudWatch Alarm State Change"]
}
您将希望将其设置为特定的警报和状态,因此您应该至少添加resource
和detail.state
部分,类似于:
{
"source": ["aws.cloudwatch"],
"detail-type": ["CloudWatch Alarm State Change"],
"resources": ["arn:aws:cloudwatch:us-east-1:123456789012:alarm:ServerCpuTooHigh"],
"detail": {
"state": {
"value": ["ALARM"]
}
}
}
英文:
EventBridge
cannot be a target for the Alarm. Instead, EventBridge
is the bus that receives all the events from AWS (and optionally from AWS Partners and your custom events). That being said, in order to catch the Alarm from Cloudwatch
into EventBridge
, you have to go to:
EventBridge
->Rules
->Create rule
In Event source
, choose AWS events or EventBrige partner events
In Sample event
you can choose CloudWatch Alarm State Change
so you can see a full list of values that you can use to filter your events.
In Event pattern
you will choose:
AWS services
-> CloudWatch
-> CloudWatch Alarm State Change
This will create an Event pattern like this:
{
"source": ["aws.cloudwatch"],
"detail-type": ["CloudWatch Alarm State Change"]
}
You will want to set it for specific alarm and state, so you should add at least resource
and detail.state
sections, something like:
{
"source": ["aws.cloudwatch"],
"detail-type": ["CloudWatch Alarm State Change"],
"resources": ["arn:aws:cloudwatch:us-east-1:123456789012:alarm:ServerCpuTooHigh"],
"detail": {
"state": {
"value": ["ALARM"]
}
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论