简体   繁体   English

如何对违反特定阈值的 EventBridge 规则数量创建警报?

[英]How to create alarm on number of EventBridge Rules breaching a certain threshold?

I have a system that auto creates and deletes CloudWatch Rules but there is a hard limit of 300 rules in every Event Bus.我有一个自动创建和删除 CloudWatch 规则的系统,但每个事件总线都有 300 条规则的硬性限制。 I want to create an alarm that gets triggered whenever a certain number, say 100, is reached.我想创建一个警报,只要达到某个数字(比如 100)就会触发该警报。 How can I do that using CDK code?我怎样才能使用 CDK 代码做到这一点?

Create a Lambda function that calls the ListRules API.创建调用ListRules API 的 Lambda 函数。 The Lambda counts the rules. Lambda 计算规则。 Have EventBridge trigger the Lambda periodically with a scheduled Rule .让 EventBridge 使用计划规则定期触发Lambda。 If you want an Alarm, your Lambda could write the rule count to CloudWatch as a custom metric and configure an Alarm to monitor it.如果您想要一个警报,您的 Lambda 可以将规则计数作为自定义指标写入 CloudWatch,并配置一个警报来监控它。 A simpler option is to have the Lambda put an SNS notification to a Topic if the rule count exceeds 100.一个更简单的选项是让 Lambda 在规则计数超过 100 时向主题发送 SNS 通知。

To recap, the CDK constructs would be: a Lambda Function , an EventBridge Rule and a CloudWatch Alarm (or SNS Topic and Subscription ).回顾一下,CDK 构造将是:一个 Lambda Function 、一个 EventBridge Rule和一个 CloudWatch Alarm (或 SNS TopicSubscription )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firestore 规则 - 如何允许创建但不允许更新? - Firestore rules - How to allow create but not update? 在 GCP 中,如何创建防火墙规则以按 IP 范围隔离子网? - In GCP, how to create firewall rules to isolate subnets by their IP ranges? 在 AWS 安全组中创建多个规则 - Create multiple rules in AWS security Group 部署到顶点 ai 时如何将阈值传递给 BigQuery ML model - how to pass threshold to BigQuery ML model when deployed to vertex ai 如何通过添加相同的间隔 x 次数来创建时间线? - SQL - How to create timeline by adding same intervals x number of times? - SQL 如何在没有前台服务/警报管理器的情况下通过 Push Notif 在 Android 上播放警报声音,而不管设备已锁定或应用程序已被杀死? - How to play an alarm sound on Android via Push Notif regardless of Device locked or App killed without Foreground Service/Alarm Manager? 使用 CLI 列出和删除 EventBridge Lambda 触发器 - List & Remove an EventBridge Lambda trigger using the CLI 如何将 cloudwatch 警报连接到 lambda 函数 - how to connect a cloudwatch alarm to a lambda function 如何在 AWS 中搜索引发指标警报的日志? - How to search for a logs that raised metric alarm in AWS? 如何通过 aws-cdk 将自定义指标和警报添加到 AWS Lambda 函数 - How to add custom Metric and Alarm to AWS Lambda function via aws-cdk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM