You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

创建关联CloudWatch告警的Route53健康检查时遇参数错误求助

解决Route53健康检查关联CloudWatch告警的参数错误问题

嘿,我帮你搞定这个问题!你遇到的错误提示Invalid parameter : Basic health checks must not have an metric region specified,根源出在CloudFormation模板的AlarmIdentifier配置上。

问题原因

Route53的基础健康检查(比如你使用的HTTPS类型)对应的CloudWatch指标是全局生效的,不需要指定区域。你在AlarmIdentifier里额外添加了Region: us-west-2参数,这违反了基础健康检查的参数规则,所以触发了报错。

修复方案

只需要把HealthCheckApi资源中AlarmIdentifier下的Region字段删除即可。修改后的完整配置如下:

...
AlertsEmailTopic:
  Type: AWS::SNS::Topic
  Properties:
    DisplayName: !Join ['', ['ApiServiceAlerts-', !Ref "AWS::StackName"]]
    Subscription:
      - Endpoint: alerts@example.com
        Protocol: email
ApiHealthCheckDownAlarm:
  Condition: CreateProdResources
  Type: AWS::CloudWatch::Alarm
  Properties:
    ActionsEnabled: true
    AlarmActions:
      - !Ref AlertsEmailTopic
    ComparisonOperator: LessThanThreshold
    EvaluationPeriods: 1
    Namespace: AWS/Route53
    MetricName: HealthCheckStatus
    Period: 300
    Statistic: Minimum
    Threshold: 1
    TreatMissingData: breaching
HealthCheckApi:
  Condition: CreateProdResources
  Type: AWS::Route53::HealthCheck
  Properties:
    HealthCheckConfig:
      Port: "443"
      Type: "HTTPS"
      ResourcePath: /
      FullyQualifiedDomainName: api.example.com
      RequestInterval: "30"
      FailureThreshold: "3"
    AlarmIdentifier:
      Name: !Ref ApiHealthCheckDownAlarm
      # 移除了不必要的Region参数
    HealthCheckTags:
      - Key: "Name"
        Value: "https://api.example.com"

修改后,CloudFormation就能正常创建关联告警的健康检查了——基础健康检查不需要指定指标区域,CloudWatch会自动关联全局的Route53指标。

内容的提问来源于stack exchange,提问作者Alex Latchford

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 09:36:21