setDesiredCapacity

Sets the size of the specified Auto Scaling group.

If a scale-in activity occurs as a result of a new DesiredCapacity value that is lower than the current size of the group, the Auto Scaling group uses its termination policy to determine which instances to terminate.

For more information, see Manual scaling in the Amazon EC2 Auto Scaling User Guide.

Samples


fun main() { 
   //sampleStart 
   // This example sets the desired capacity for the specified Auto Scaling group.
autoScalingClient.setDesiredCapacity {
    autoScalingGroupName = "my-auto-scaling-group"
    desiredCapacity = 2
    honorCooldown = true
} 
   //sampleEnd
}