How to use EC2 Auto Scaling and the Application Load Balancer to handle increased load on your app

EC2 Auto Scaling is a feature in EC2 which allows you to maintain the availability of your applications by adding and removing EC2 instances according to some conditions that you define.

In this video we also use an application load balancer which will distribute the load to the EC2 instances. This load balancer has a target group which serve as traffic targets and it is attached to an Auto Scaling Group. Whenever our application is under heavy load this is detected by monitoring CPU usage.

When CPU usage is above 50% this will trigger an Auto Scaling action which will add an instance to our Auto Scaling Group (this is called scaling out). If the load is still high it will add another instance and so on. If the load disappears then instances are removed which is known as scaling in.

Recent Articles

Related Stories

2 Comments

  1. thanks for your great tutorials, I followed exactly your instructions, and used your userdata script, but my connection failed with timeout when I opened the IP,… whats wrong?

    #!/bin/bash
    yum update -y
    yum install httpd -y
    service httpd start
    chkconfig httpd on
    cd /var/www/html
    instance_id=$(curl http://169.254.169.254/latest/meta-data/instance-id)
    availability_zone=$(curl http://169.254.169.254/latest/meta-data/placement/availability-zone)
    echo “Test Launch Template successfully implementedpage generated by instance $instance_idin availability zone
    $availability_zone“> index.html
    amazon-linux-extras install epel -y
    yum install stress -y

Leave a Reply to László B. Cancel reply

Please enter your comment!
Please enter your name here