I am in the INSUFFICENT_DATA state constantly for my scale down cloudwatch alarm. The cloudwatch alarm is attached to my autoscaling group. I have had my scale down alarm be in this state for the past 3 days, so it's definitly done initializing.
In my alarm it gives the reason of
Unchecked: Initial alarm creation
This is from the aws docs: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html
INSUFFICIENT_DATA—The alarm has just started, the metric is not available, or not enough data is available for the metric to determine the alarm state
Here is a snippet from my cloudformation template that makes the cloudwatch alarm. It is in troposphere syntax but it should be easy enough to read:
template.add_resource(Alarm(
"CPUUtilizationLowAlarm",
ActionsEnabled=True,
AlarmDescription="Scale down for average CPUUtilization <= 30%",
Namespace="AWS/EC2",
MetricName="CPUUtilization",
Statistic="Average",
Period="300",
EvaluationPeriods="3",
Threshold="30",
Unit="Percent",
ComparisonOperator="LessThanOrEqualToThreshold",
AlarmActions=[Ref("ScaleDownPolicy")],
Dimensions=[
MetricDimension(
Name="AutoscalingGroupName",
Value=Ref("AutoScalingGroup")
)
]
))
template.add_resource(ScalingPolicy(
"ScaleDownPolicy", #Simple reference value, nothing special
AdjustmentType="ChangeInCapacity", #Modify the asg capacity
AutoScalingGroupName=Ref("AutoScalingGroup"), #What asg to modify capacity
PolicyType="SimpleScaling", #Read about it here: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scale-based-on-demand.html
Cooldown="1700", #How long to wait before checking status' again
ScalingAdjustment=Ref("DownscalingCount") #(Must be a negative number!!) How much to scale down
))
As you can see I am scaling down based on the CPUUtilization <= 30%. This is a valid metric from what I can see. I have read this stack overflow answer but it doesn't seem to apply to this situation: Amazon EC2 AutoScaling CPUUtilization Alarm- INSUFFICIENT DATA
I do almost the exact same thing but use "Step Scaling" instead of "Simple Scaling", like above, but it actually works for me. Here is a snippet from my cloudformation template for my step scaling alarm (Scale up):
template.add_resource(Alarm(
"CPUUtilizationHighAlarm",
ActionsEnabled=True,
AlarmDescription="Scale up for average CPUUtilization >= 50%",
MetricName="CPUUtilization",
Namespace="AWS/EC2",
Statistic="Average",
Period="300",
EvaluationPeriods="1",
Threshold="50",
Unit="Percent",
ComparisonOperator="GreaterThanOrEqualToThreshold",
AlarmActions=[Ref("ScaleUpPolicy")],
Dimensions=[
MetricDimension(
Name="AutoScalingGroupName",
Value=Ref("AutoScalingGroup")
)
]
))
template.add_resource(ScalingPolicy(
"ScaleUpPolicy",
AdjustmentType="ChangeInCapacity",
AutoScalingGroupName=Ref("AutoScalingGroup"), #What group to attach this to
EstimatedInstanceWarmup="1700", #How long it will take before instance is ready for traffic
MetricAggregationType="Average", #Breach if average is above threshold
PolicyType="StepScaling", #Read above step scaling here: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scale-based-on-demand.html
StepAdjustments=[
StepAdjustments(
MetricIntervalLowerBound="0", #From 50 (Defined in alarm as 50% CPU)
MetricIntervalUpperBound="20", #To 70%
ScalingAdjustment="1" #Scale up 1 instance
),
StepAdjustments(
MetricIntervalLowerBound="20", #from 70%
MetricIntervalUpperBound="40", #to 90%
ScalingAdjustment="2" #Scale up 2 instances
),
StepAdjustments(
MetricIntervalLowerBound="40", #From 90% or above (Defined in alarm)
ScalingAdjustment="3" #Scale up 2 instances
)
]
))
I am at a lost as to what I have configured wrong in my scale down alarm. If anyone has any suggestions or help that would be great.