Continuing with the topic of Guildline Settings, the basic function modules on Amazon Web Service, after the tutorial on setting Management Tools (CloudWatch & CloudTrail) on AWS, I will introduce Auto Scaling on AWS.
1. Auto Scaling
What is Auto Scaling?
First we will find out what Auto Scaling is:
- Basics: Auto Scaling is the process of automatically scaling out or scaling out EC2 instances based on the traffic requirements of the application or system.
- AWS defines Auto Scaling as follows: Auto Scaling allows the user to have an exact number of EC2 instances available to handle the application load . We can create a collections set of EC2 instances, called Auto Scaling Group . Users can also specify the number of EC2 instance min min of each Auto Scaling Group, and Auto Scaling will adjust to ensure that the number of EC2 instace provided to the system never falls below this number. Conversely, the user can also specify the maximum number of EC2 instances of each Auto Scaling Group to ensure that the number of EC2 instances provided to the system never exceeds the maximum. If the user wants to specify the desired capacity, the user can create a group at that time or at any later time, Auto Scale will always ensure the user has the desired number of EC2 instances. And if we specify scaling policies, Auto Scale can perform launch or terminate instances based on the increasing or decreasing demand of the Application.
2. Auto Scaling Basics:
2.1 Basic model of Auto Scaling
- Based on the traffic demand, ELB will perform load balancing for the system, if the traffic load exceeds the handling capacity of the existing EC2 instace number, Auto Scaling will launch a new EC2 instance. For example: If the system has EC2 Instance min number of 2. Each EC2 instance can bear maximum load when there is 3 user access. When the system has 6 users who want to access the system at the same time, ELB will automatically balance the load by allowing a group of 3 users to access 2 different EC2 Instane Note: In the case the number of users simultaneously accessing is 4 user. ELB will also automatically load balancing by giving a group of 2 users access to 2 EC2 Instances at the same time. This is to ensure the server is not overloaded and crashes.
- At the same time, it will arise the case that the number of users who want to access the system exceeds the load that the EC2 instance can bear. Then if the ELB continues to allow current users to access the existing EC2 Instances, it will lead to overload, affecting the performance of the whole system and if it continues for a certain period of time, the whole the system set will crash. Impact range will affect all users accessing at that time.
- Then, the Auto Scale will automatically launch a new EC2 to bear the load for abnormally increased hits.
- Then, if the number of users accessing the system decreases. Auto Scale will automatically terminate unused EC2 instances to avoid incurring costs
2.2 Pricing / Cost overview Auto Scale can be used for FREE, however users will be charged for Auto Scale Provision (eg any EC2 Instance exceeding Free Tier will charge Auto Scale Provision fee)
3. Setting Auto Scale
Basic steps setting Auto Scale:
- Select AMIs
- Choose an Instance Type
- Proceed to settings for Launch template and initialize launch template
Optional: bash script to install Apache web server software
yum update -y
yum install -y httpd
service httpd start