If you’re using AWS, you can now create Auto Scaling Groups that grow and shrink in response to changing conditions, while also making use of the most economical combination of EC2 instance types and pricing models. You have full control of the instance types that will be used to build your group, along with the ability to control the mix of On-Demand and Spot. You can also update your existing Auto Scaling Groups to take advantage of this new feature.
The Auto Scaling Groups that you create are optimized anew each time a scale-out or scale-in event takes place, always seeking the lowest overall cost while meeting the other requirements set by your configuration. You can modify the configuration as newer instance types become available, allowing you to create a group that evolves in step with EC2.
How One AI-Driven Media Platform Cut EBS Costs for AWS ASGs by 48%
Creating an Auto Scaling Group
You can create an Auto Scaling Group from the EC2 Console, CLI, or API. The first step is to make sure that you have a suitable Launch Template (it should not specify the use of Spot Instances). Here’s an example:
Then you navigate to my Auto Scaling Groups and click Create Auto Scaling group:
Click Launch Template, select my ProdWebServer template, and click Next Step to proceed:
Name your group and select Combine purchase models and instances to unlock the new functionality:
Now select the instance types that you want to use. The list is prioritized: instances at the top of the list will be used in preference to those lower down when On-Demand instances are launched. For example, if your will run fine on M4 or M5 instances with 2 or more vCPUs:
You can accept the default settings for my group’s composition or you can set them myself by unchecking Use default:
Here’s what you can do:
Maximum Spot Price – Sets the maximum Spot price that you want to pay. The default setting caps this bid at the On-Demand price.
Spot Allocation Strategy – Control the amount of per-AZ diversity for the Spot Instances. A larger number adds some flexibility at times when a particular instance type is in high demand within an AZ.
Optional On-Demand Base – Controls how much of the initial capacity is made up of On-Demand Instances. Keeping this set to 0 indicates that you prefer to launch On-Demand Instances as a percentage of the total group capacity that is running at any given time.
On-Demand Percentage Above Base – Controls the percentage of the add-on to the initial group that is made up of On-Demand Instances versus the percentage that is made up of Spot Instances.
As you can see, you have full control over how your group is built. You leave them all as-is, set my group to start with 4 instances, choose my VPC subnets, and click Next to set up your scaling policies, as usual:
You can disable scale-in if you want (it’s disabled here for demo purposes):
You then click past the Configure Notifications, and indicate that you want to tag my group and the EC2 instances in it:
You can review your settings and click Create Auto Scaling Group to move ahead:
The initial group of four instances is ready to go within minutes:
You can filter by tag in the EC2 Console and display the Lifecycle column to see the mix of On-Demand and Spot Instances:
You can modify your Auto Scaling Group, reducing the On-Demand Percentage to 20% and doubling the Desired Capacity (this is a demo-mode way of showing what happens when the group scales out):
The changes take effect within minutes; new Spot Instances are launched, some of the existing On-Demand Instances are terminated, and the composition of the group reflects the new settings:
Here are a couple of things to keep in mind when you start to use this cool new feature:
Reserved Instances – AWS plans to add support for the preferential use of Reserved Instances in the near future. Today, if you own Reserved Instances, specify their instance types as early as possible in the list we showed you earlier. Your discounts will apply to any On-Demand instances that match available Reserved Instances.
Weight – All instance types have the same weight; we plan to give you the ability to specify weights in the near future. This will allow you to specify custom capacity units for each instance using either memory or vCPUs, and to specify the overall desired capacity in the same units.
Cost – The feature itself is available to you at no charge. If you switch part or all of your Auto Scaling Groups over to Spot Instances, you may be able to save up to 90% when compared to On-Demand Instances.
ECS and EKS – If you are running Amazon ECS or Amazon Elastic Container Service for Kubernetes on a cluster that makes use of an Auto Scaling Group, you can update the group to make use of multiple instance types and purchase options.
This feature is available now and you can start using today in all commercial AWS regions!