ec2_metric_alarm doesn't detect SNS notification

21 views
Skip to first unread message

Bhotu

unread,
Jan 27, 2016, 2:35:49 PM1/27/16
to Ansible Project

Here is my ansible-script to create alarms and notification through ec2_metric_alarm module. I can successfully create the scaling part, but I cannot able to create the SNS notification.



    - name: Create or delete AWS metric alarms metrics you wish to alarm on must already exists

      local_action:

        module: ec2_metric_alarm

        region: us-east-1

        name: "{{ item.name }}"

        state: present

        metric: "CPUUtilization"

        namespace: "AWS/EC2"

        statistic: "Average"

        comparison: "{{ item.comparison }}"

        threshold: "{{ item.threshold }}"

        period: 60

        evaluation_periods: 3

        unit: "Percent"

        dimensions:

          AutoScalingGroupName: "testing-ASG"

        alarm_actions: "{{ item.alarm_actions }}"

 

      with_items:

         - name: "testing-SCALE-UP"

           comparison: ">="

           threshold: 70.0

           alarm_actions:

             - "{{ autoscaling.results[0].arn }}"

             - arn:aws:sns:us-east-1:465404434664:Polanotify

 

         - name: "testing-SCALE-DOWN"

           comparison: "<="

           threshold: 20.0

           alarm_actions:

             - "{{ autoscaling.results[1].arn }}"

             - arn:aws:sns:us-east-1:465404434664:Polanotify


here is the error I am getting:



[u'arn:aws:autoscaling:us-east-1:465404434664:scalingPolicy:267c5e14-e272-4e16-9d8f-88544e9ca4ca:autoScalingGroupName/testing-ASG:policyName/Increase Group Size', u'arn:aws:sns:us-east-1:465404434664:Polanotify'], u'name': u'testing-SCALE-UP'}) => {"failed": true, "item": {"alarm_actions": ["arn:aws:autoscaling:us-east-1:465404434664:scalingPolicy:267c5e14-e272-4e16-9d8f-88544e9ca4ca:autoScalingGroupName/testing-ASG:policyName/Increase Group Size", "arn:aws:sns:us-east-1:465404434664:Polanotify"], "comparison": ">=", "name": "testing-SCALE-UP", "threshold": 70.0}, "msg": "BotoServerError: 400 Bad Request\n<ErrorResponse xmlns=\"http://monitoring.amazonaws.com/doc/2010-08-01/\">\n  <Error>\n    <Type>Sender</Type>\n    <Code>ValidationError</Code>\n    <Message>Invalid arn syntax: ['arn:aws:autoscaling:us-east-1:465404434664:scalingPolicy:267c5e14-e272-4e16-9d8f-88544e9ca4ca:autoScalingGroupName/testing-ASG:policyName/Increase Group Size', 'arn:aws:sns:us-east-1:465404434664:Polar1notify']</Message>\n  </Error>\n  <RequestId>8df5ae3d-c528-11e5-9f41-2352ce248144</RequestId>\n</ErrorResponse>\n"}


What could be the possible problem ?

Reply all
Reply to author
Forward
0 new messages