本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
为 EventBridge 全局端点设置 Route 53 运行状况检查
使用全局端点时,必须进行 Route 53 运行状况检查,以监控各区域的状态。以下模板定义了一条 Amazon CloudWatch 警报,并用它来定义 Route 53 运行状况检查。
用于定义 Route 53 运行状况检查的 AWS CloudFormation 模板
使用以下模板定义您的 Route 53 运行状况检查。
Description: |- Global endpoints health check that will fail when the average Amazon EventBridge latency is above 30 seconds for a duration of 5 minutes. Note, missing data will cause the health check to fail, so if you only send events intermittently, consider changing the heath check to use a longer evaluation period or instead treat missing data as 'missing' instead of 'breaching'. Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: "Global endpoint health check alarm configuration" Parameters: - HealthCheckName - HighLatencyAlarmPeriod - MinimumEvaluationPeriod - MinimumThreshold - TreatMissingDataAs ParameterLabels: HealthCheckName: default: Health check name HighLatencyAlarmPeriod: default: High latency alarm period MinimumEvaluationPeriod: default: Minimum evaluation period MinimumThreshold: default: Minimum threshold TreatMissingDataAs: default: Treat missing data as Parameters: HealthCheckName: Description: Name of the health check Type: String Default: LatencyFailuresHealthCheck HighLatencyAlarmPeriod: Description: The period, in seconds, over which the statistic is applied. Valid values are 10, 30, 60, and any multiple of 60. MinValue: 10 Type: Number Default: 60 MinimumEvaluationPeriod: Description: The number of periods over which data is compared to the specified threshold. You must have at least one evaluation period. MinValue: 1 Type: Number Default: 5 MinimumThreshold: Description: The value to compare with the specified statistic. Type: Number Default: 30000 TreatMissingDataAs: Description: Sets how this alarm is to handle missing data points. Type: String AllowedValues: - breaching - notBreaching - ignore - missing Default: breaching Mappings: "InsufficientDataMap": "missing": "HCConfig": "LastKnownStatus" "breaching": "HCConfig": "Unhealthy" Resources: HighLatencyAlarm: Type: AWS::CloudWatch::Alarm Properties: AlarmDescription: High Latency in Amazon EventBridge MetricName: IngestionToInvocationStartLatency Namespace: AWS/Events Statistic: Average Period: !Ref HighLatencyAlarmPeriod EvaluationPeriods: !Ref MinimumEvaluationPeriod Threshold: !Ref MinimumThreshold ComparisonOperator: GreaterThanThreshold TreatMissingData: !Ref TreatMissingDataAs LatencyHealthCheck: Type: AWS::Route53::HealthCheck Properties: HealthCheckTags: - Key: Name Value: !Ref HealthCheckName HealthCheckConfig: Type: CLOUDWATCH_METRIC AlarmIdentifier: Name: Ref: HighLatencyAlarm Region: !Ref AWS::Region InsufficientDataHealthStatus: !FindInMap [InsufficientDataMap, !Ref TreatMissingDataAs, HCConfig] Outputs: HealthCheckId: Description: The identifier that Amazon Route 53 assigned to the health check when you created it. Value: !GetAtt LatencyHealthCheck.HealthCheckId
事件 ID 可能会随着 API 调用而变化,因此跨区域关联事件需要有一个不可变的唯一标识符。在进行与使用者有关的设计时,还应考虑到幂等性。这样一来,如果您要复制事件或从存档中重放事件,在两个区域中处理事件就不会产生任何副作用。
CloudWatch 警报模板属性
注意
对于所有 editable
字段,请考虑您的每秒吞吐量。如果您只是间歇性地发送事件,请考虑将运行状况检查更改为使用更长的评估期,或者将缺失的数据视为 missing
,而不是 breaching
。
模板的 CloudWatch 警报部分使用了以下属性:
指标 | 描述 |
---|---|
|
警报的描述。 默认: |
|
与警报关联的指标的名称。这是基于指标的警报所必需的。对于基于数学表达式的警报,您应改为使用 默认:IngestionToInvocationStartLatency |
|
与警报关联的指标的命名空间。这是基于指标的警报所必需的。对于基于数学表达式的警报,您无法指定 默认: |
|
与警报关联的指标的统计数据,而不是百分位数。 默认:平均值 |
|
以秒为单位的周期,每经过该时长,即应用统计数据。这是基于指标的警报所必需的。有效值为 10、30、60,以及 60 的任何倍数。 默认: |
|
其间的数据将与指定阈值进行比较的期间数。如果您设置的警报需要连续超出多个数据点才能触发警报,则此值将指定该数字。如果要设置“N 个中的 M 个”警报,则此值为 N, 默认: |
|
要与指定的统计数据进行比较的值。 默认: |
|
将指定统计数据与阈值进行比较时使用的算术运算。指定的统计值将用作第一个操作数。 默认: |
|
设置该警报应如何处理缺失数据点。 有效值: 默认: |
Route 53 运行状况检查模板属性
注意
对于所有 editable
字段,请考虑您的每秒吞吐量。如果您只是间歇性地发送事件,请考虑将运行状况检查更改为使用更长的评估期,或者将缺失的数据视为 missing
,而不是 breaching
。
模板的 Route 53 运行状况检查部分使用了以下属性:
指标 | 描述 |
---|---|
|
运行状况检查的名称。 默认: |
|
当 CloudWatch 没有充足的指标数据来确定警报状态时,您希望 Amazon Route 53 分配给运行状况检查的状态。 有效值:
默认:运行不正常 注意此字段将根据 |