2. Create VPC and Subnet
And, click “Auto Scaling Groups”.
And, click “Create Auto Scaling group”.
Then, input Auto Scaling group name as you like.
Select Launch Templates you already created and click “Next”.
You can choose instance purchase option. I selected “Adhere to launch template” this time.
Next, please designate VPC and subnet. You had better select multiple subnets for redundant configuration.
Next, choose Load balancing option. If you already created ELB, you can select existing ELB. Or you can create ELB in this phase. In my case, I skipped to designate/create ELB and select “No load balancer”.
Next, decide Group size. Desired capacity is initial number of EC2 instance. According to your auto-scale setting, this number will be adjusted automatically. And input Minimum capacity and Maximum capacity by considering your budget and availability level.
And, set scaling policies to enable auto-scaling function. Select “Target tracking scaling policy” and “Metric type”. In my case, if CPU utilization exceeds 30%, EC2 instance will be added automatically.
Next, add notifications if you want to receive it. It is optional setting and I didn’t set it. Click “Next”.
And set tags as you like.
Finally, review your setting and click “Create Auto Scaling group”.
OK, Auto Scaling group is created successfully !!
Check detail of Auto Scaling groups. The number of Desired capacity is 1. This means Only One EC2 instance is started in this Auto Scaling groups.
Next, let’s check if auto scaling function works properly. In my EC2 instance, I executed below command to increase CPU utilization.
$ yes > /dev/null
You can see CPU utilization becomes around 100%. In a few minutes, new EC2 instance will be added automatically. Please check detail of Auto Scaling groups again.
Desired capacity is changed from 1 to 3.
And, please check “Activity” information.
Auto Scaling event is recorded and the number of instance is increased !!