15

I am currently using two scaling policies which are attached to my auto scaling group: A

  1. A scale up policy which is invoked when a CloudWatch alarm is invoked. This CloudWatch alarm uses the CPUUtilization metric and fires at CPU over 80%.
  2. The other is a scale down policy which is invoked when a different CloudWatch alarm is invoked. This CloudWatch alarm uses the CPUUtilization metric and fires when the CPU is under 50%.

The side effect of this approach is that when my ASG instances are idle (fully scaled down, no processing occurring) my ASG is in an alarm state.

Is there a way to set this up differently so that my ASG is not in a state of constant alarm?

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"
  }
},
Nick S.
  • 2,203
  • 3
  • 19
  • 21
  • This "problem" is bothering me too. I didn't find a solution yet either. There is a thread on the aws forum: https://forums.aws.amazon.com/thread.jspa?threadID=175650 – Tom Sep 01 '16 at 08:15

2 Answers2

9

This is the normal and expected behavior.

Having a metric in the alarm state is not a problem - remember that it is the change of an alarm state that triggers events. So presumably once your scale up trigger goes into alarm, the scale down would come out of alarm. Then when the metric goes down, it goes back into an alarm state, and a scale down event is triggered.

chris
  • 36,094
  • 53
  • 157
  • 237
  • 6
    Although this is the normal behavior, it doesn't really answer the question. When I see RED in my CLoudWatch panel, it's supposed to mean there is a problem, not that everything is alright. Or at least that's what I would want from CloudWatch. – Cyril Duchon-Doris Jun 19 '16 at 11:36
  • 1
    @CyrilDuchon-Doris: you can always put in a feature request with the CloudWatch team. There really is no other easy answer to the question. – chris Jun 20 '16 at 15:15
6

You can hide these in the Console, by clicking the "Hide Autoscaling Alarms" checkbox.

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/hide-autoscaling-alarms.html

Still not ideal, but better than nothing.

Marc
  • 824
  • 10
  • 18