Examples for creating and managing warm pools with the AWS CLI
You can create and manage warm pools using the AWS Management Console, AWS Command Line Interface (AWS CLI), or SDKs.
The following examples show you how to create and manage warm pools using the AWS CLI.
Contents
Example 1: Keep instances in the
Stopped
state
The following put-warm-poolStopped
state.
aws autoscaling put-warm-pool --auto-scaling-group-name
my-asg
/ --pool-state Stopped
Example 2: Keep instances in the
Running
state
The following put-warm-poolRunning
state instead of a Stopped
state.
aws autoscaling put-warm-pool --auto-scaling-group-name
my-asg
/ --pool-state Running
Example 3: Keep instances in the
Hibernated
state
The following put-warm-poolHibernated
state instead of a Stopped
state. This lets
you stop instances without deleting their memory contents (RAM).
aws autoscaling put-warm-pool --auto-scaling-group-name
my-asg
/ --pool-state Hibernated
Example 4: Return instances to the warm pool when scaling in
The following put-warm-poolStopped
state and includes the --instance-reuse-policy
option. The instance reuse policy value '{"ReuseOnScaleIn": true}'
tells Amazon EC2 Auto Scaling to return instances to the warm pool when your Auto Scaling group scales
in.
aws autoscaling put-warm-pool --auto-scaling-group-name
my-asg
/ --pool-stateStopped
--instance-reuse-policy '{"ReuseOnScaleIn": true}'
Example 5: Specify the minimum number of instances in the warm pool
The following put-warm-pool
aws autoscaling put-warm-pool --auto-scaling-group-name
my-asg
/ --pool-stateStopped
--min-size4
Example 6: Define the warm pool size using a custom specification
By default, Amazon EC2 Auto Scaling manages the size of your warm pool as the difference between
the maximum and desired capacity of the Auto Scaling group. However, you can manage the size
of the warm pool independently from the group's maximum capacity by using the
--max-group-prepared-capacity
option.
The following put-warm-pool
aws autoscaling put-warm-pool --auto-scaling-group-name
my-asg
/ --pool-stateStopped
--max-group-prepared-capacity900
To maintain a minimum number of instances in the warm pool, include the
--min-size
option with the command, as follows.
aws autoscaling put-warm-pool --auto-scaling-group-name
my-asg
/ --pool-stateStopped
--max-group-prepared-capacity900
--min-size25
Example 7: Define an absolute warm pool size
If you set the same values for the --max-group-prepared-capacity
and
--min-size
options, the warm pool has an absolute size. The
following put-warm-pool
aws autoscaling put-warm-pool --auto-scaling-group-name
my-asg
/ --pool-stateStopped
--min-size10
--max-group-prepared-capacity10
Example 8: Delete a warm pool
Use the following delete-warm-pool
aws autoscaling delete-warm-pool --auto-scaling-group-name
my-asg
If there are instances in the warm pool, or if scaling activities are in progress,
use the delete-warm-pool--force-delete
option.
This option also terminates the Amazon EC2 instances and any outstanding lifecycle
actions.
aws autoscaling delete-warm-pool --auto-scaling-group-name
my-asg
--force-delete