I have a load balancer that I created an auto-scaling-group and launch-config for. I created the auto-scaling-group with a min-size of 1 and max size of 20. I have a scaledown policy:
as-put-scaling-policy SBMScaleDownPolicy --auto-scaling-group SBMAutoScaleGroup --adjustment=-1 --type ChangeInCapacity --cooldown 300
Then I set up an alarm:
mon-put-metric-alarm SBMLowCPUAlarm --comparison-operator LessThanThreshold --evaluation-periods 1 --metric-name CPUUtilization --namespace "AWS/EC2" --period 600 --statistic Average --threshold 35 --alarm-actions arn:aws:autoscaling:us-east-1:policystuffhere:autoScalingGroupName/SBMAutoScaleGroup:policyName/SBMScaleDownPolicy --dimensions "AutoScalingGroupName=SBMAutoScaleGroup"
When average CPU usage over 10 minutes is under 35, in CloudFront the alarm shows up as "In Alarm State" but doesn't decrease the number of instances. Also, if there's only one instance running it'll spin up another to 2 even if a scale up alarm isn't hit. It seems like the default value is just set to 2 somehow. How can I change this?
A likely cause is that you are more than one Availability Zone enabled, and it is ensuring there is at least 1 instance in each zone.
Presumably your auto scaling group SBMAutoScaleGroup is not quite configured as desired - have you double checked the outcome of CreateAutoScalingGroup? See example 7 within section Command Line Tools Example on page Auto Scaling with Alarms and Load Balancing for an easy way to do this:
The resulting table should show the desired values for MIN-SIZE, MIN-SIZE and DESIRED-CAPACITY.
Likewise you might want to verify that the policy has been attached correctly:
The resulting table should list your auto scaling policy SBMScaleDownPolicy with the desired values for ADJUSTMENT, TYPE and COOLDOWN.
A possible reason why
as-put-scaling-policy
might have failed is mentioned in example 5 within section Command Line Tools Example on page Auto Scaling with Alarms and Load Balancing, which stresses a specific requirement when using the Windows command line:Figured it out. I had manually added the first instance to the load balancer. After removing that one everything functioned as expected.