Autoscaling is the mechanism to scale out EC2 instances seamlessly and automatically when demand increases. It also helps to increase the resource vertically like CPU/Memory etc. A.S will also increase the number of instances as per the requirement .
Horizontal scaling means that you scale by adding more machines into your pool of resources.
Vertical scaling means that you scale by adding more power (CPU, RAM) to your existing machine
What is the purpose of Autoscaling
- Load on application varies
- A good design must take care of varying load
- Since load spike cannot be anticipated always, manual scaling is not the solution
- Other solution is to over provision resources
- This is inefficient and costly
- Auto scaling is the best solution for dealing with varying load
The Autoscaling process
Horizontal & Vertical scaling
Horizontal scaling means that you scale by adding more machines into your pool of resources.
Vertical scaling means that you scale by adding more power (CPU, RAM) to your existing machine
Steps for Autoscaling configuration
1. Login to AWS console go to services and select Autoscaling
2. Select the first option to create the launch configuration
3. Select the AMI ( Amazone Machine Image) from the My AMI session which will be used to create the new instances . You can create the image from any existing EC2 instances ( Detailed steps for creating AMI's are mentioned in the Load balacer configuration session )
4. Select the type of instances from the next step
5. Next step is to give the name for Launch configuration ( As i didn't configured any IAM roles i have kept it as blank and cloud watch detailed monitoring also)
6. Select the storage and security group as per the requirement ( i have enabled port 22 and 80 in the security group )
7. Review the Launch configuration settings and create it
8. Create / select the Key pair
9. Now we have successfully configured the launch configuration as below
10 .Now let us start the autoscaling configuration , provide the AS name, VPC details ( default) and subnet details where the autoscaling instances need to be expanded
11. We have to mention the target group which includes the information about the EC2 instances which is including the ASG . The health check grace period of the instances is mentioned as 300 sec
12. Configure the scaling policies and alarm as below ( Here when the average CPU utilisation is greater than or equal to 90 % for 2 consecutive period of 5 minuets , it will create a new instance )
13.Now review the settings and configure the auto scaling group
14. You can see 2 new instances are created with the autoscaling group tag and you can add any existing instances to the new autoscaling group also.
We have created a sample autoscaling setup ..
Thanks for reading the content and welcoming your valuable feedback
12. Configure the scaling policies and alarm as below ( Here when the average CPU utilisation is greater than or equal to 90 % for 2 consecutive period of 5 minuets , it will create a new instance )
13.Now review the settings and configure the auto scaling group
14. You can see 2 new instances are created with the autoscaling group tag and you can add any existing instances to the new autoscaling group also.
We have created a sample autoscaling setup ..
Thanks for reading the content and welcoming your valuable feedback
good blog
ReplyDeletevery usefull
aws certification training