In step scaling policy, we can define the instance warmup, wich is the time the autoscaling grop waits until consider an instance in aggregated metrics of the Auto Scaling group, as the aws own’s docummentation says. I create an autoscaling group and define the instance warmup as 240 seconds wich is the enough time for my situation. The cooldown period is not applied and has no effect to stepscaling policy, only for simple scaling policies,as the aws own’s docummentation says, as well. I have defined differents healthcheck grace periods and regardless of them I get the same problem.
I have 1 instance running on my ASG. A scaling action is started wich leads to the creation of a second instance. After 240 seconds, when the warmup time expires a third instance is also launched because the second instance has not yet entered in the CloudWatch Metrics.
I do not know how can I overcome this problem changing the architecture parameters. If the cooldown time had effect in this case, it was enough to set this time larger than the warmup time.
Step scaling policy is AWS recommended strategy.
Step scaling policies increase or decrease the current capacity of your Auto Scaling group based on a set of scaling adjustments, known as step adjustments. The adjustments vary based on the size of the alarm breach.
After a scaling activity is started, the policy continues to respond to additional alarms, even while a scaling activity or health check replacement is in progress. Therefore, all alarms that are breached are evaluated by Amazon EC2 Auto Scaling as it receives the alarm messages. As breach alarms are received Auto Scaling will respond suitably.
Since the scaling is based on "size of breach" – if the 2nd alarm is bigger than the first and requires to add 2 instances – the 2nd additional instance will also be added. So duplication is avoided- similar to warmup.
"multiple alarm breaches that fall in the range of the same step adjustment result in a single scaling activity. This ensures that we don’t add more instances than you need."
So you have to check Amazon EC2 Auto Scaling alarms in the Cloud Watch console to see what is going on.
Besides what all are the implications of: " instance has not yet entered in the CloudWatch Metrics due to warmup period" – is not clear to me. It likely means CloudWatch is still looking only at the first instance – and its CPU utilization. Lets say it breaches next level then it could trigger another alarm leading to 3rd instance. (Cooldown period is designed to prevent exactly this- makes sense). So let us know what you see in the cloudwatch console.