I am using cloud watch CLI to write a script . As part of this script I need to create an alarm when the status check fails.
Steps followed –
1) First I create a launch config for an AMI
2) Then autoscaling group, scale up policy.
3) Now , I need to create a alarm such that when an instance belonging to Ami ( from step 1) fails, then raise an alarm which essentially creates a new instance.
I am having issues with creating an alarm for the same. Help appreciated.
mon-put-metric-alarm TestAlarm –comparisonoperator LessThanToThreshold –evaluation-periods 1 –metric-name StatusCheckFailed –namespace “AWS/EC2” –period 600 –statistic Average –threshold 1 –alarm-actions arn:aws:autoscaling:TestInstance –dimensions “AutoScalingGroupName=TestAutoScalingGroup”
The error received is Status Check failed not recognized.
mon-put-metric-alarm AuthServerAlarm –comparison-operator GreaterThanOrEqualToThreshold –evaluation-periods 1 –region us-west-1 –metric-name StatusCheckFailed_Any –namespace “AWS/EC2” –period 600 –statistic Average –threshold 1 –alarm-actions arn:aws:autoscaling:us-west-1:13445335:scalingPolicy:1234:newGuid:autoScalingGroupName/TestAutoScalingGroup:policyName/LaunchNewInstance,arn:aws:sns:us-west-1:123:Test –dimensions “AutoScalingGroupNameTestAutoScalingGroup”