A warm pool is a pool of pre-initialized EC2 instances that sits alongside an Auto Scaling group. Whenever your application needs to scale out, gives you the ability to decrease latency for your applications that have exceptionally long boot times.
Set the warm pool size:
It’s important to decide how to set the warm pools size as it will make huge difference in associated cost. Plan a minimum and a maximum boundaries for the warm pool:
You can keep instances in the warm pool in one of three states: Stopped, Running, or Hibernated (if supported by the instance type). Keeping instances in a Stopped state is an effective way to minimize costs. With stopped instances, you pay only for the volumes that you use and the Elastic IP addresses attached to the instances.
By default when ASG scales in instances it get terminated but in warm pools, you can configure reuse policy to return instances to warm pool.
Limitations: You cannot add a warm pool to Auto Scaling groups that have a mixed instances policy or that launch Spot Instances.
In this step, you add a warm pool to your Auto Scaling group to pre-initialize your instances, so that instances can be brought into service more rapidly.
You want to keep your warm pool instances in a stopped state after they have completed their initialization actions. You will set the optional warm pool sizing parameters
--min-size to 2 and leave
--max-group-prepared-capacity empty. This means that this warm pool has a minimum size of 2 and a maximum prepared capacity equal to the max size of the Auto Scaling group. The maximum prepared capacity includes instances launched into the Auto Scaling group, and instances launched into the warm pool.
aws autoscaling put-warm-pool --auto-scaling-group-name "ec2-workshop-asg" --pool-state Stopped --min-size 2
Now let’s check the warm pool in the AWS Console