Webapp Deployment with an AWS AutoScaling Group, an Application Load Balancer, and a Dynamic Scaling policy (metric: CPU Utilization) configured using a CloudWatch Alarm, SNS and IAM.
YouTube Video URL: https://youtu.be/dMUQTQS1l3g
YouTube Channel: https://www.youtube.com/@techapricate
Please follow the below steps to configure a WebApp running on an AWS EC2 instance (part of AutoScaling Group attached to an Application LB).
- Create an IAM user (example: adminjohn with Administrator access).
- Create a Security Group for LT (Launch Template) and ALB (Application Load balancer).
- Create a LT and an ASG (AutoScaling Group).
- Launch an EC2 instance from LT.
- SSH to the EC2 Instance and register a custom AMI (Amazon Machine Image) with WebApp Configuration.
WebApp configuration steps:
sudo su -
yum install httpd -y
git clone https://github.com/bhavukm/webapp-asg-alb.git
cp -r webapp-asg-alb/* /var/www/html
systemctl start httpd
systemctl enable httpd
- Update the LT with new AMI.
- Perform ASG Instance Refresh.
- Create a TG (Target Group)) and an ALB.
- Attach the ALB with ASG.
- Create a Dynamic Scaling Policy with a CloudWatch Alarm and SNS (Simple Notification Service).
- Run CPU stress test on the ASG and check if scaling event triggers.
Steps to install and configure stress utility on Amazon Linux:-
amazon-linux-extras install epel –y
yum install stress -y
stress --cpu 1 --timeout 800 &
Architectural Diagram:-
AWS SNS:
AWS CloudWatch:


