1.1 KiB
1.1 KiB
AWS Auto Scaling Groups - Dynamic Scaling Policy
Requirements
- Existing Auto Scaling Group with maximum capacity set to at least 3
- One running EC2 instance with max of 4 CPUs
Objectives
- Create a dynamic scaling policy with the following properties
- Track average CPU utilization
- Target value should be 70%
- Increase the CPU utilization to at least 70%
- Do you see change in number of instances?
- Decrease CPU utilization to less than 70%
- Do you see change in number of instances?
Solution
Console
-
Go to EC2 service -> Auto Scaling Groups and click on the tab "Automating scaling"
-
Choose "Target tracking scaling" under "Policy Type"
-
Set metric type to Average CPU utilization
-
Set target value to 70% and click on "Create"
-
If you are using Amazon Linux 2, you can stress the instance with the following:
sudo amazon-linux-extras install epel -y
sudo yum install stress -y
stress -c 4 # assuming you have 4 CPUs
-
Yes, additional EC2 instance was added
-
Simply stop the stress command
-
Yes, one of the EC2 instances was terminated