AWS CloudFormation
User Guide (API Version 2010-05-15)
AWS 服务或AWS文档中描述的功能,可能因地区/位置而异。请点击 Amazon AWS 入门,可查看中国地区的具体差异

CloudWatch 指标维度属性类型

指标维是 AWS::CloudWatch::Alarm 类型的嵌入式属性。维度是可与 CloudWatch 指标关联的任意名称/值对。您最多可以为给定指标指定 10 个维度。

语法

JSON

{ "Name" : String, "Value" : String }

YAML

Name: String Value: String

属性

Name

维度的名称,长度在 1–255 个字符之间。

Required: Yes

Type: String

Value

表示维度衡量标准的值,长度在 1–255 个字符之间。

Required: Yes

Type: String

示例

两个 CloudWatch 警报,具有 Ref 函数提供的维度值

RefFn::GetAtt 内部函数通常用于为 CloudWatch 指标维提供值。下面是 Ref 函数的使用示例。

"CPUAlarmHigh": { "Type": "AWS::CloudWatch::Alarm", "Properties": { "AlarmDescription": "Scale-up if CPU is greater than 90% for 10 minutes", "MetricName": "CPUUtilization", "Namespace": "AWS/EC2", "Statistic": "Average", "Period": "300", "EvaluationPeriods": "2", "Threshold": "90", "AlarmActions": [ { "Ref": "WebServerScaleUpPolicy" } ], "Dimensions": [ { "Name": "AutoScalingGroupName", "Value": { "Ref": "WebServerGroup" } } ], "ComparisonOperator": "GreaterThanThreshold" } }, "CPUAlarmLow": { "Type": "AWS::CloudWatch::Alarm", "Properties": { "AlarmDescription": "Scale-down if CPU is less than 70% for 10 minutes", "MetricName": "CPUUtilization", "Namespace": "AWS/EC2", "Statistic": "Average", "Period": "300", "EvaluationPeriods": "2", "Threshold": "70", "AlarmActions": [ { "Ref": "WebServerScaleDownPolicy" } ], "Dimensions": [ { "Name": "AutoScalingGroupName", "Value": { "Ref": "WebServerGroup" } } ], "ComparisonOperator": "LessThanThreshold" } }

另请参阅

本页内容: