Amazon EC2 Auto Scaling helps ensure that you have the correct number of Amazon EC2 instances available to handle the load for your application.
Auto-scaling groups are collections of EC2 instances that you build. Each auto-scaling group has a minimum number of instances that can be specified, and Amazon EC2 Auto Scaling makes sure that your group never drops below this amount. You can also select the maximum number of instances in each auto-scaling group, and Amazon EC2 Auto Scaling ensures that your group never goes past this size.
You must deploy all of your instances in various availability zones if you want your applications to have a highly available and fault-tolerant architecture.
In the event of an outage, this will assist you in isolating your resources.
Be aware that in order to achieve fault tolerance, you must have backup resources ready to go. This will help you prevent system degradation in the event that a server fails or an availability zone goes down.
A fault-tolerant design incurs additional costs by requiring the use of more resources than is typically required. This is to ensure that only mission-critical workloads are processed.
Auto-scaling cooldown period:
- It ensures that the Auto Scaling group does not launch or terminate additional EC2 instances before the previous scaling activity takes effect.
- Its default value is 300 seconds, i.e., 5 minutes.
- It is a configurable setting for your Auto Scaling group.
Launch configuration:
A launch configuration is a template
that an auto-scaling group uses to launch EC2 instances.
When you create a launch configuration, you specify information for the instances, such as the ID of the Amazon Machine Image (AMI), the instance type, a key pair, one or more security groups, and a block device mapping. If you’ve launched an EC2 instance before, you specified the same information in order to launch the instance.
You can specify your launch configuration with multiple auto-scaling groups. However, you can only specify one launch configuration for an auto-scaling group at a time, and you can’t modify a launch configuration after you’ve created it.
Therefore, if you want to change the launch configuration for an Auto Scaling group, you must first create a new launch configuration and then update your Auto Scaling group with the new launch configuration.
Scale-in Policy:
- Select the instances with the
oldest
launch configuration. - Select the instance that is
closest
to thenext billing hour
. Choose the availability zone with the
highest number of instances
.Auto-scaling Policies:
Target tracking scaling
``` – Increase or decrease the current capacity of the group based on a target value for a specific metric. This is similar to the way that your thermostat maintains the temperature of your home – you select a temperature and the thermostat does the rest.
Step scaling ``` – Increase or decrease the current capacity of the group based on a set of scaling adjustments, known as step adjustments, that vary based on the size of the alarm breach.
Simple scaling
``` – Increase or decrease the current capacity of the group based on a single scaling adjustment.
Scheduled scaling policy ``` is based on a schedule that allows you to set your own scaling schedule for predictable load changes. This is not considered as one of the types of dynamic scaling.
The benefits of auto-scaling:
- Make wise scaling choices.
- Pay Only for What You Need
- Make wise scaling choices.
- Setup scaling quickly