由cloudformation模板形成时,AWS cloudwatch警报无法访问EMR集群指标中的数据

时间:2020-05-22 07:29:23

标签: amazon-web-services amazon-cloudformation amazon-emr amazon-cloudwatch

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Metadata": {
        "AWS::CloudFormation::Designer": {
            "0146279a-ddf6-40fa-bf45-612cebe20c3f": {
                "size": {
                    "width": 60,
                    "height": 60
                },
                "position": {
                    "x": 290,
                    "y": 80
                },
                "z": 0,
                "embeds": []
            },
            "f53318cc-f7a9-4e0b-9d22-7de325b7409d": {
                "size": {
                    "width": 60,
                    "height": 60
                },
                "position": {
                    "x": 430,
                    "y": 80
                },
                "z": 0
            }
        }
    },
    "Resources": {
        "EMRC1YFGX": {
            "Type": "AWS::EMR::Cluster",
            "Properties": {
                "ReleaseLabel": "emr-5.30.0",
                "Instances": {
                    "MasterInstanceGroup": {
                        "InstanceCount": 1,
                        "InstanceType": "m5.xlarge"
                    },
                    "CoreInstanceGroup": {
                        "InstanceCount": 1,
                        "InstanceType": "m5.xlarge"
                    }
                },
                "Name": "Tupac",
                "JobFlowRole": "arn:aws:iam::261537044157:instance-profile/EMR_EC2_DefaultRole",
                "ServiceRole": "arn:aws:iam::261537044157:role/shubhamam"
            },
            "Metadata": {
                "AWS::CloudFormation::Designer": {
                    "id": "0146279a-ddf6-40fa-bf45-612cebe20c3f"
                }
            }
        },
        "CWA2VB7L": {
            "Type": "AWS::CloudWatch::Alarm",
            "Properties": {
                "AlarmName": "alarm101",
                "AlarmActions": ["arn:aws:sns:us-east-1:2615370449570:emr_idle_notification"],
                "ComparisonOperator": "GreaterThanOrEqualToThreshold",
                "Dimensions": [
                    {
                        "Name": "JobflowId",
                        "Value": {"Ref": "EMRC1YFGX"}
                    }
                ],
                "EvaluationPeriods": 1,
                "MetricName": "IsIdle",
                "Namespace": "AWS/ElasticMapReduce",
                "Period": 300,
                "Statistic": "Minimum",
                "Threshold": 1,
            },
            "Metadata": {
                "AWS::CloudFormation::Designer": {
                    "id": "f53318cc-f7a9-4e0b-9d22-7de325b7409d"
                }
            }
        }
    }
}

我正在使用上述cloudformation模板来创建我的EMR集群和Cloudwatch警报。如果我从控制台创建了正常警报,则它无法正常工作,但是在cloudformation期间创建时,它不起作用。 警报已创建,但无法从EMR指标获取任何数据。它说没有数据,并且仍处于数据不足状态。

1 个答案:

答案 0 :(得分:0)

明显的问题是使用JobflowId而不是JobFlowId

这是因为维名称是区分大小写的

我在CloudWatch中找不到有关维度名称区分大小写的文档,因此我通过创建两个警报来自己进行了测试

一个警报基于正确拼写的维度名称AmazonEC2(计费指标)。第二次警报基于拼写错误的拼写名称:AmazonEc2。两个警报之间的其他所有内容都相同。

我发现名称不正确的警报已堆积在 INSUFFICIENT 状态中。这与OP报告的状态相同。

警报的屏幕截图(费用已消失):

enter image description here