我正在尝试编写一个自定义CloudWatch事件模式,该模式将触发SSM运行命令。我遇到的问题是,我不确定应该如何编写这个事件模式。我看了文档,只是不知道该怎么做。文档给出了一个示例,例如:
{
"source": [ "aws.ec2"]
}
它将监视来自EC2服务的所有事件。但我该怎么看,比如。。。CloudWatch日志日志组中的特定消息?
回答原始问题。这是一个样品。
{
"source": ["aws.ec2"],
"detail-type": ["EC2 Instance State-change Notification"],
"detail": {
"state": ["running"]
}
}
你可以在https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-and-event-patterns.html.肯定是Content-based Filtering with Event Patterns
页面类似
{
"time": [ { "prefix": "2017-10-02" } ],
"detail": {
"state": [ { "anything-but": "initializing" } ],
"c-count": [ { "numeric": [ ">", 0, "<=", 5 ] } ],
"d-count": [ { "numeric": [ "<", 10 ] } ],
"x-limit": [ { "anything-but": [ 100, 200, 300 ] } ]
}
}