I currently use two scaling policies that are tied to my autoscale group: A
- The scaling policy that is invoked when a CloudWatch call is invoked. This CloudWatch alarm uses the CPUUtilization metric and is triggered by more than 80% in the CPU.
- The other is a scaling policy that is invoked when another CloudWatch signal is invoked. This CloudWatch signal uses the CPUUtilization indicator and is triggered when the processor is at less than 50%.
A side effect of this approach is that when my ASG instances are idle (completely reduced, processing does not occur), my ASG is in an alarm state.
Is there a way to set this differently so that my ASG is not in a constant state of alert?
Below is a segment of these alarms from my CloudFormation template:
"ScaleUpPolicy" : { "Type" : "AWS::AutoScaling::ScalingPolicy", "Properties" : { "AdjustmentType" : "ChangeInCapacity", "AutoScalingGroupName" : { "Ref" : "WebApplicationASG" }, "Cooldown" : "1", "ScalingAdjustment" : "1" } }, "CPUAlarmHigh": { "Type": "AWS::CloudWatch::Alarm", "Properties": { "EvaluationPeriods": "1", "Statistic": "Average", "Threshold": "80", "AlarmDescription": "Alarm if CPU too high or metric disappears indicating instance is down", "Period": "60", "AlarmActions": [ { "Ref": "ScaleUpPolicy" } ], "Namespace": "AWS/EC2", "Dimensions": [ { "Name": "AutoScalingGroupName", "Value": { "Ref": "WebApplicationASG" } } ], "ComparisonOperator": "GreaterThanThreshold", "MetricName": "CPUUtilization" } }, "ScaleDownPolicy" : { "Type" : "AWS::AutoScaling::ScalingPolicy", "Properties" : { "AdjustmentType" : "ChangeInCapacity", "AutoScalingGroupName" : { "Ref" : "WebApplicationASG" }, "Cooldown" : "1", "ScalingAdjustment" : "-1" } }, "CPUAlarmLow": { "Type": "AWS::CloudWatch::Alarm", "Properties": { "EvaluationPeriods": "1", "Statistic": "Average", "Threshold": "50", "AlarmDescription": "Alarm if CPU is low, causing scale down", "Period": "60", "AlarmActions": [ { "Ref": "ScaleDownPolicy" } ], "Namespace": "AWS/EC2", "Dimensions": [ { "Name": "AutoScalingGroupName", "Value": { "Ref": "WebApplicationASG" } } ], "ComparisonOperator": "LessThanThreshold", "MetricName": "CPUUtilization" } },