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 ?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a96e1617-7d8e-439a-acf6-bf36e9f4203e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to