创建EventBridge规则触发LimitExceededException异常求助
问题描述
创建EventBridge规则时触发以下异常:
LimitExceededException: The requested resource exceeds the maximum number allowed for AWS
当前单区域内仅统计到73条EventBridge规则,而根据AWS官方文档,单区域规则数量上限为300,需排查可能忽略的要点。
创建规则的Terraform代码片段:
resource "aws_cloudwatch_event_rule" "testing" { count = var.some_condition ? 1 : 0 name = var.resource_name event_pattern = jsonencode({ "detail" = { "requestParameters" = { "key" = [for val in var.my_list : { wildcard = "${val[\"v1\"]}/*/" }] } } }) }
my_list定义:
my_list = [ { "v1" = "myV1" } ]
完整错误信息:
│ Error: creating EventBridge Rule (test-eb): LimitExceededException: The requested resource exceeds the maximum number allowed. │ │ with module.sample.aws_cloudwatch_event_rule.testing[0], │ on modules/test/main.tf line 30, in resource "aws_cloudwatch_event_rule" "testing": │ 30: resource "aws_cloudwatch_event_rule" "testing" {
可能忽略的要点
- 关联资源的配额限制:EventBridge的配额不止规则数量,还需检查:
- 单条规则关联的目标数量上限(默认5个)
- 事件模式的复杂度配额(比如
key数组扩容后可能触发单规则的匹配条目限制) - 账户内总线总数、目标总数等其他EventBridge相关资源配额
- 未被统计的规则资源:
- 清理废弃规则:检查是否存在通过Terraform部署后被注释但未执行
destroy的规则,或控制台/CLI创建后遗忘删除的规则 - 排查嵌套模块:多层Terraform模块可能重复创建规则,未被计入你统计的73条总数
- 共享总线规则:多账户共享总线时,总线所属账户的规则计数包含其他账户创建的规则
- 清理废弃规则:检查是否存在通过Terraform部署后被注释但未执行
- 配额的范围验证:
- 确认当前操作区域与统计73条规则的区域一致
- 部分EventBridge配额是账户全局级别,而非单区域限制
- 临时或异常配额调整:
- 账户曾触发异常操作可能导致配额被临时降低,检查AWS Support控制台是否有相关通知
- 可能存在AWS内部临时调整的配额限制
- Terraform状态不一致:
- 用
terraform state list | grep aws_cloudwatch_event_rule查看Terraform管理的规则数量,对比AWS控制台实际存在的规则数,排查状态文件与实际资源不一致的情况
- 用
内容的提问来源于stack exchange,提问作者user1119283
相关产品推荐
相关产品推荐

