In the testing results mentioned earlier, we can see that when the application receives many requests, it becomes unstable. The solution is to increase the number of EC2 Instances in the system and use a Load Balancer to distribute the requests from users.
However, this manual method is not very practical because to launch an EC2 Instance, we need to have the “core” inside it, which is the application responsible for handling those requests along with other libraries.
In the EC2 management console, scroll down the selection panel on the right.
In the Auto Scaling group creation interface, enter the following information:
FCJ-Management-ASG
FCJ-Management-template
(or any name you choose).Note that the ASG name should match the name of the ASG set in section 2.6, which is for preparing data for Predictive Scaling.
The Launch template selected for the ASG must be the one configured with MySQL Client, Node, Source Code, and PM2 to ensure the Targets operate normally. If you followed the steps in sections 2 and 3, you have done it correctly.
In the Network section, select the following information:
Previously, we created an Application Load Balancer and a Target Group and attached it to the Load Balancer. Now, select the following options:
When the Target Group and Application Load Balancer are correctly configured, the Existing load balancer target group option will show the Target Group, indicating that both ALB and TG exist.
In the VPC Lattice integration options: select No VPC Lattice service, as we are not configuring this option in this tutorial.
Next, in Health checks, select (check) Turn on Elastic Load Balancing health checks. Leave the remaining settings as default.
In the Additional settings section, under Monitoring:
In this section, define the group’s scaling behavior and the number of Instances to be created during scaling, including scaling out (expanding) and scaling in (shrinking).
In the Automatic scaling - optional section: choose No scaling policies for now, as we won’t configure scaling policies for the ASG yet.
In the Instance maintenance policy section: choose No policy.
We are not configuring ASG policies here because we will apply scaling strategies later, including four different strategies.
In this section, we’ll configure email notifications (using Amazon SNS) when the ASG:
We’ll create notifications for one email address, including the following details:
asg-topic
. Select a topic to send notifications.Review the information and click Create Auto Scaling group.
During the creation process, an email will be sent, so make sure to check and confirm email notifications from the selected topic.
Since we set Desired capacity = 1, when the ASG is created, it will automatically launch a new Instance, and you’ll receive a new email.
Check the Activity tab of the FCJ-Management-ASG to verify.
During the execution of other scaling strategies, you may receive many emails, so keep an eye on your inbox. This is intentional to help monitor what is happening more easily.