Table of contents
No headings in the article.
Generally, if you dont use ASG, you will need to manually configure your instances to run in multiple availability zones, and you will need to implement your own mechanisms to replace instances that fail. So it is more difficult to achieve high availability and fault tolerance for your application without ASG.
An Auto Scaling Group (ASG) enables you to scale your EC2 instances based on demand automatically. The main purpose of an ASG is to ensure that you have the right number of instances running to handle the load on your application.
The goal of the auto-scaling group is to
πScale-out (add ec2 instances) to match an increased load
π Scale in (remove ec2 instances) to match decreased load
π and sure we have a minimum and maximum number of ec2 instances running
π automatically register new instances to A Load Balancer
π Re-create an ec2 instance in case of previous one is unhealthy/terminated
(ASG is free).
Scale-Out - Adding Instances
Scale In - Removing instances
Minimum Capacity
Minimum capacity is the minimum number of instances that you want to have running at all times, even during periods of low demand.
Desired Capacity
Desired capacity is the number of instances that you want to have running at any given time to handle the current demand for your application
Maximum Capacity
The maximum capacity should be set based on the limits of your infrastructure, the maximum capacity your application can handle efficiently, and your budget.
If you move your desired capacity to a higher number and if it is less than the maximum capacity, then it will scale out the instances.
Based on Cloud watch alarms, we can scale instances.
Lets do Hands-On
Make sure you don't have instances. Because ASG will take care of that.
Goto ASG, and create ASG
Create Launch Template
You can see that instances were automatically scaled.
Activity can be seen under activity section
Dynamic Scaling Policies