EC2 Auto Scaling is a fully managed service that helps your application get the required number of instances by automatically launching or terminating EC2 instances.
We generally create collections of EC2 instances known as Auto Scaling Groups, each having a specified number of instances. Auto-scaling ensures that size gets maintained, not letting the group go above or beyond.
However, an Auto Scaling Group is only one of the three components of EC2 Auto Scaling. Please go through this quick read to learn about all of them.
What Are the 3 Major Components of EC2 Auto Scaling?
Amazon EC2 Auto Scaling is a type of horizontal scaling that lets you scale up or scale down the number of instances as per requirements. You can define the scaling policies and set the desired capacity by specifying the minimum and maximum values. And the number of instances gets adjusted accordingly.
The three major components of EC2 Auto Scaling are:
- Auto Scaling Groups
- Configuration Templates
- Scaling Options
1. Auto Scaling Group
The Auto Scaling Group is a collection of EC2 instances that the system uses as a logical unit for management and scaling. During its creation, you can define the desired number of EC2 instances and, in turn, determine the size of the auto-scaling group. You can adjust it manually or leave it to automatic scaling.
Initially, the system launches sufficient EC2 instances according to the set capacity. So that the fixed number doesn’t change, the instances go through a periodic health check. If an instance is unhealthy, the Auto Scaling Group terminates it and launches a new one as a replacement.
Besides, there are scaling policies that you can use to adjust the number of instances in a scaling group. The policy will create new instances and terminate old ones while keeping the capacity within the predefined range. This method comes in handy when meeting changing conditions.
2. Configuration Template
A configuration template is what your Auto Scaling Group uses as a guideline to launch and configure new instances. It does so either through a launch template or a launch configuration.
Note that a launch configuration is the older way of defining instance launch settings for Auto Scaling Groups. It is less flexible and feature-rich compared to a launch template. Hence, we recommend using a launch template instead.
What Does a Configuration Template Contain?
A configuration template contains the AMI ID, type of instance, key pair, security groups, and device mapping. When there’s a need to launch new instances or terminate existing ones, the Auto Scaling Group uses the configuration you specified in the launch template or launch configuration.
3. Scaling Option
A scaling option lets you select how your Auto Scaling Group will behave when it scales up or down. Amazon EC2 Auto Scaling offers the following scaling options.
Manual Scaling: Manual scaling is when you exclusively indicate alterations in the maximum, minimum, or desired capacity of your Auto Scaling Group. It is the most basic scaling option, where EC2 Auto Scaling sees over launching or deleting instances to meet the set capacity.
Maintain current instance levels at all times: You can configure an Auto Scaling Group to maintain a fixed number of running EC2 instances. When you choose this option, EC2 Auto Scaling will perform a periodic health check and replace unhealthy instances.
Scheduled Scaling: EC2 Auto Scaling will scale up or down based on a predictable time and date. We recommend this when you’re aware of the exact time to adjust the number of instances in your Auto Scaling Group.
Demand-based Scaling: It is a form of dynamic scaling that allows you to set a scaling policy for the dynamic resizing of the Auto Scaling Group. This option is more viable when the system has to meet changes in demand, but the exact timing of the demand is unknown.
Predictive Scaling: It considers the daily and weekly patterns of traffic flows and adjusts the number of instances in advance.
People Also Asked
Q. What is the purpose of EC2 Auto Scaling?
EC2 Auto Scaling helps maintain the correct number of instances needed to handle your application’s load. It does so by dynamically launching and terminating EC2 instances. The purpose is cost management and efficient use of resources.
Q. On which type of EC2 instances Auto Scaling can be done?
You can use EC2 Auto Scaling on On-Demand Instances, Spot Instances, or both.
Q. What is the difference between EC2 Auto Scaling and AWS Auto Scaling?
AWS Auto Scaling allows for scaling Amazon cloud services to meet utilization targets. In contrast, EC2 Auto Scaling focuses on scaling EC2 instances to meet application needs.
That’s about it. We hope this article provided a clear overview of the three components of EC2 Auto Scaling and their functions. However, if you have any further queries, ask them in the comment section below. We shall get back to you. Thanks for reading.