AWS Eventbridge 事件未触发 Lambda 函数
AWS Eventbridge Event not triggering Lambda function
我已经实施了 AWS Eventbridge 规则和 Lambda 函数的基本组合作为其目标。该规则假设基于所有 AWS AutoScaling 事件创建一个事件并调用 Lambda。
这在触发现有 ASG 的缩放操作时效果很好,但在创建具有相同前缀的新 ASG 时,规则没有反应。
旧 ASG 名称:test-asg-lc-123
新 ASG 名称:test-asg-lc-124
甚至可以使用通配符吗?
"detail": {
"AutoScalingGroupName": [
"test-asg-lc-*"
]
},
"detail-type": [
"EC2 Instance Launch Successful",
"EC2 Instance Terminate Successful",
"EC2 Instance Launch Unsuccessful",
"EC2 Instance Terminate Unsuccessful",
"EC2 Instance-launch Lifecycle Action",
"EC2 Instance-terminate Lifecycle Action",
"EC2 Auto Scaling Instance Refresh Checkpoint Reached"
],
"source": [
"aws.autoscaling"
]
}
在这种情况下似乎不支持通配符。 AWS 文档提到 The matching is exact (character-by-character), without case-folding or any other string normalization.
,文档中没有提到 * 或通配符。
参考:https://docs.aws.amazon.com/eventbridge/latest/userguide/filtering-examples-structure.html
您可以按照本文档中提到的前缀匹配 https://docs.aws.amazon.com/eventbridge/latest/userguide/content-filtering-with-event-patterns.html#filtering-prefix-matching
基于@Husyns 的回答,非常感谢他,我想分享一个有一些限制的工作解决方案(什么限制,请查看 Husyns 回答下面的评论)。
{
"detail-type": [
"EC2 Instance Launch Successful",
"EC2 Instance Terminate Successful"
],
"detail": {
"AutoScalingGroupName": [
{
"prefix": "test-asg-lc-"
}
]
},
"source": [
"aws.autoscaling"
]
}
我已经实施了 AWS Eventbridge 规则和 Lambda 函数的基本组合作为其目标。该规则假设基于所有 AWS AutoScaling 事件创建一个事件并调用 Lambda。 这在触发现有 ASG 的缩放操作时效果很好,但在创建具有相同前缀的新 ASG 时,规则没有反应。 旧 ASG 名称:test-asg-lc-123 新 ASG 名称:test-asg-lc-124
甚至可以使用通配符吗?
"detail": {
"AutoScalingGroupName": [
"test-asg-lc-*"
]
},
"detail-type": [
"EC2 Instance Launch Successful",
"EC2 Instance Terminate Successful",
"EC2 Instance Launch Unsuccessful",
"EC2 Instance Terminate Unsuccessful",
"EC2 Instance-launch Lifecycle Action",
"EC2 Instance-terminate Lifecycle Action",
"EC2 Auto Scaling Instance Refresh Checkpoint Reached"
],
"source": [
"aws.autoscaling"
]
}
在这种情况下似乎不支持通配符。 AWS 文档提到 The matching is exact (character-by-character), without case-folding or any other string normalization.
,文档中没有提到 * 或通配符。
参考:https://docs.aws.amazon.com/eventbridge/latest/userguide/filtering-examples-structure.html
您可以按照本文档中提到的前缀匹配 https://docs.aws.amazon.com/eventbridge/latest/userguide/content-filtering-with-event-patterns.html#filtering-prefix-matching
基于@Husyns 的回答,非常感谢他,我想分享一个有一些限制的工作解决方案(什么限制,请查看 Husyns 回答下面的评论)。
{
"detail-type": [
"EC2 Instance Launch Successful",
"EC2 Instance Terminate Successful"
],
"detail": {
"AutoScalingGroupName": [
{
"prefix": "test-asg-lc-"
}
]
},
"source": [
"aws.autoscaling"
]
}