Amazon EC2 Auto Scaling
User Guide

Auto Scaling Groups

An Auto Scaling group contains a collection of EC2 instances that share similar characteristics and are treated as a logical grouping for the purposes of instance scaling and management. For example, if a single application operates across multiple instances, you might want to increase the number of instances in that group to improve the performance of the application, or decrease the number of instances to reduce costs when demand is low. You can use the Auto Scaling group to scale the number of instances automatically based on criteria that you specify, or maintain a fixed number of instances even if an instance becomes unhealthy. This automatic scaling and maintaining the number of instances in an Auto Scaling group is the core functionality of the Amazon EC2 Auto Scaling service.

An Auto Scaling group starts by launching enough EC2 instances to meet its desired capacity. The Auto Scaling group maintains this number of instances by performing periodic health checks on the instances in the group. If an instance becomes unhealthy, the group terminates the unhealthy instance and launches another instance to replace it. For more information about health check replacements, see Maintaining the Number of Instances in Your Auto Scaling Group.

You can use scaling policies to increase or decrease the number of instances in your group dynamically to meet changing conditions. When the scaling policy is in effect, the Auto Scaling group adjusts the desired capacity of the group and launches or terminates the instances as needed. You can also manually scale or scale on a schedule. For more information, see Scaling the Size of Your Auto Scaling Group.

Using Multiple Instance Types and Purchase Options

To maximize your cost savings and obtain the desired scale for your application, you can provision and automatically scale Spot Instances with On-Demand and Reserved Instances within a single Auto Scaling group.

You specify the common configuration parameters in a launch template and choose it when you create an Auto Scaling group that specifies the instance types, the distribution of On-Demand Instances and Spot Instances, the maximum price to pay for Spot Instances, and other settings that tell the Auto Scaling group how to allocate instance types to fulfill capacity. Deploying your application across multiple instance types is used to enhance availability, while giving you the benefit of the least expensive and available instance types.

When you configure the Auto Scaling group, you can choose a low or high number of Spot pools (instances of the same type and OS within an Availability Zone) to allocate your Spot Instances across. For example, if you run batch processing, we recommend specifying a low number of Spot pools (for example, two Spot pools) to ensure that your queue always has compute capacity while maximizing cost savings. If you run a web service, we recommend specifying a high number of Spot pools (for example, 10 Spot pools) to minimize the impact if a Spot pool becomes temporarily unavailable.

If you choose to specify a base capacity of On-Demand Instances, the Auto Scaling group ensures that this base capacity is provisioned first when the group scales out. Anything beyond the base capacity uses percentages to determine how many On-Demand Instances and Spot Instances to launch. For example, if you specify a base capacity of 10 On-Demand Instances, and specify percentages of 0% for On-Demand Instances and 100% for Spot Instances, the behavior of the Auto Scaling group as it increases in size is as follows:

Example: Before your Auto Scaling group can start launching Spot Instances, it must first provision the base portion of On-Demand Instances

Total Number of Running Instances On-Demand Instances (10) Spot Instances (100%)
5 5 0
10 10 0
15 10 5
20 10 10

To learn how to configure a group to use multiple instance types and purchase options, see Creating an Auto Scaling Group Using a Launch Template.

To learn about Amazon EC2 pricing and purchase options, see Amazon EC2 Pricing.