我已将Route53 HealthCheck配置为与CloudFormation相关联的警报,但生成的健康检查显示为未配置警报,并且CloudWatch控制台中的警报仍然无效。如果我在HealthChecks中手动创建警报,一切正常。
更糟糕的是,如果我从悉尼/ ap-southeast-2
切换并在北弗吉尼亚州/ us-east-1
创建相同的云形成堆栈,则警报与健康检查正确关联,一切正常!
还有一个数据点:在Route53 HealthChecks中手动创建警报时,警报在us-east-1
中创建,尽管Route53是全局的,ap-southeast-1
是所有其他控制台中的默认值。
我的简化堆栈如下所示:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "healthcheck alarm test",
"Resources": {
"StatusHealthCheck": {
"Type": "AWS::Route53::HealthCheck",
"Properties": {
"HealthCheckConfig": {
"Port": "80",
"Type": "HTTP",
"ResourcePath": "/status",
"FullyQualifiedDomainName": "testdomain.com",
"RequestInterval": "30",
"FailureThreshold": "1"
},
"HealthCheckTags": [
{
"Key": "Name",
"Value": "status reachability check"
}
]
}
},
"StatusHealthCheckFailedAlarm": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"ActionsEnabled": "true",
"AlarmDescription": "alarmed when status doesn't respond",
"ComparisonOperator": "LessThanThreshold",
"EvaluationPeriods": "1",
"MetricName": "HealthCheckStatus",
"Namespace": "AWS/Route53",
"Period": "60",
"Statistic": "Minimum",
"Threshold": "1.0",
"Dimensions": [
{
"Name": "HealthCheckId",
"Value": {
"Ref": "StatusHealthCheck"
}
}
]
}
}
}
}
有什么理由它应该在北弗吉尼亚州工作但不在悉尼工作吗?
答案 0 :(得分:6)
HealthCheck生成的CloudWatch指标仅在美国东部地区可见,如本页底部http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/health-checks-monitor-view-status.html所述。这就是在us-east-1中创建堆栈时正常工作的原因。
答案 1 :(得分:0)
该任务只能使用lamba函数来实现,因为:
这意味着,不可能仅使用纯 CloudFormation 语法。
您可以使用 lambda 函数创建警报,如下所示: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/cloudwatch-examples-creating-alarms.html#cloudwatch-examples-creating-alarms-putmetricalarm