在 AWS CloudWatch 中可以按照以下代码示例添加 EventPattern,以确保在单个事件中只发送一个警报通知:
{
"source": [
"aws.ec2"
],
"detail-type": [
"EC2 Instance State-change Notification"
],
"detail": {
"state": [
"running"
]
}
}
在这个 EventPattern 中,只有当'EC2 Instance State-change Notification”事件的'state”值为'running”时,才会触发警报通知。如果事件的'state”值发生变化,将会重新触发警报通知。通过使用 EventPattern,可以在单个事件中收到警报,而不是多个重复的警报通知。