遇到不受支持的属性CompareOperator

时间:2020-01-08 07:19:48

标签: amazon-cloudformation amazon-cloudwatch cloudwatch-alarms

Cloudformation堆栈在使用cloudformation创建AWS :: CloudWatch :: Alarm时抛出错误“遇到不受支持的属性比较运算符”

根据AWS文档 ComparisionOperator GreaterThanOrEqualtoThreshold 是有效的。 我将AWSTemplateFormatVersion用作 2010-09-09

任何帮助将不胜感激:)

"CPUHighAlarm":{
            "Type":"AWS::CloudWatch::Alarm",
            "Properties":{
                "AlarmDescription":"High CPU utilization",
                "MetricName":"CPUUtilization",
                "Namespace":"AWS/EC2",
                "AlarmActions":[{"Ref":"asgScaleOut"}],
                "ComparisionOperator": "GreaterThanOrEqualtoThreshold",
                "EvaluationPeriods": "1",
                "Threshold": "70",
                "Period":"180",
                "Statistic": "Average",
                "Dimensions": [
                    {
                        "Name": "AutoScalingGroupName",
                        "Value": {
                            "Ref": "asg"
                        }
                    }
                ]
            }
        },

2 个答案:

答案 0 :(得分:0)

也许是区分大小写的。尝试GreaterThanOrEqualToThreshold

答案 1 :(得分:0)

只是一个错字。应该是ComparisonOperator而不是ComparisionOperator

CloudFormation Linter可以帮助您更快地捕获这些错误,而Visual Studio Code extension可以通过自动完成功能来防止错别字:

E3002: Invalid Property Resources/CPUHighAlarm/Properties/ComparisionOperator