Auto Scaling Overview
Auto Scaling allows you to make sure that the correct number of EC2 instances is always running to handle the application’s load.
Auto Scaling allows for better fault tolerance, availability, and cost management.
This document helps to specify scaling policies that can used to launch and terminate EC2 instances in order to deal with any increase or decrease of demand.
Auto Scaling attempts evenly distribute instances among the AZs that have been enabled for it.
Auto Scaling attempts to launch new instances in the AZ that has the least number of instances. Auto Scaling ComponentsAuto Scaling groups – ASG
Auto Scaling groups are the heart of Auto Scaling. They contain a group of EC2 instances with similar characteristics. These instances are treated as a logical collection for automatic scaling and management.
ASG requires Launch configuration OR Launch Template
The minimum and maximum capacity determine the number of instances an autoscaling policy can be applied.
These limits are too restrictive to allow for an increase in the number of instances.
Desired capacity to determine how many instances the ASG must keep at all times. It is equal to the minimum size if it is absent.
The minimum capacity and the desired capacity are different.
The desired capacity of an Auto Scaling group is the maximum number of instances that can be run. The minimum capacity of a group is the lowest number of instances it can have running
Subnets or Availability Zones where the instances will launch.
Metrics and Health Checksmetrics to decide when to launch or terminate instances, and health checks to determine whether the instance is healthy.
ASG begins by launching a desired number of instances. It then maintains that number by performing periodic health check.
If an instance becomes unwell, the ASG will terminate it and launch a new one.
ASG can also use scaling strategies to automatically increase or decrease the number instances to meet changing demand.
An ASG may contain EC2 instances within one or more AZs in the same region.
ASGs are not able to be used in multiple locations.
ASG can launch Spot Instances or On-Demand Instances.
To merge multiple single-zone ASGs into one ASG that spans multiple AZs, you need to rezone one single-zone group into a multizone group and then delete the others. This works for groups without or with load balancers, provided that the new multi-zone group is located in the same AZs.
ASG can be associated to a single launch configuration, template, or combination thereof
The Launch Configuration cannot be modified after it has been created. Therefore, you can only update the Launch Configuration for ASGs by creating a new one and associating it with the ASG.
The launch configuration for ASG can be changed. Any new instances that are launched will use the new parameters. Existing instances will not be affected.
If ASG is not running instances, you can delete it from CLI. Otherwise, set the minimum and desired capacities to 0. Launch Configuration
Launch configuration is a template for instance configuration that an ASG uses in order to launch EC2 instances.
Launch configuration is similar in nature to EC2 configuration. It involves selecting the Amazon Machine Image (AMI), key pair, block devices, key pair and instance type. Security groups, user data, EC2 instance monitoring and instance profile. Kernel, ramdisk, instance tenancy.
Multiple ASGs can be linked to launch configuration
Launch configuration cannot be modified after it has been created. If any modifications are required, they must be created from scratch.
Monitoring the cases in the casebook: Basic or more detailed
