How to Set Up Auto Scaling with AWS Load Balancer?

In this blog, we would discuss how to to use Auto Scaling with Elastic Load Balancer. To understand more on Auto Scaling and how to configure it, I would suggest you to go through blogs (link) and (link)

We would cover below points throughout this blog

  • Create Load Balancer
  • Create Launch Configuration
  • Create Auto Scaling Group with ELB

Create Load Balancer

1. Go to AWS EC2 Console and Click on Create Load Balancer

2. Select a Classic Load Balancer

3. Assign an existing Security group or Create a new SG

4. Click on Next without any change in Configure Security Settings

5. Click on Configure Health Check without any change

6. In Add Instance step, do not select any EC2 for now and Click on Add Tags to provide a key-value pair

7. Click on Review & Create

By following the above steps, your Classic Load Balancer is created successfully.

Note: For Classic Load Balancer, Target group is not required. Its required only for Application Load Balancer

Create Launch Configuration

1. Go to EC2 Console & Click on Create Launch Configuration

2. Select your AMI required to configure the Auto Scale in AWS

3. Click on Configure Details

4. Click on Add Storage

5. Click on Configure Security Group

6. Review the Launch Configuration

7. Select an existing Key Pair or Create a new Pair

8. Create Launch Configuration

Create Auto Scaling Group with ELB

1.Click on Create Auto Scaling Group

Here, we would start with 2 Instances [Minimum you could get started with 1 Instance] and Select default VPC and Subnet as per your Region

Now, Click on Advanced details. Select the Load Balancing option to receive the traffic from your classic load balancer

Select your Classic LB and Health Check Type as EC2 and proceed for next steps

With Protect from Scale in Option in Instance Protection, newly launched instances would be protected from scale in by default.

2. Configure Scaling Policies

In Configure Scaling Policy, select the scaling policy to adjust your group capacity. Here we would scale between 2 to 2 instances

In Scale Group Size, Assign a target value for CPU utilization. You could also configure the Scale In and Scale Out policies as per previous blog

3. Click on Configure Notification to Add Notification

4. Click on Configure Tags to provide a key-value pair

5. Click on Review and Create Auto Scaling Group

With Create Auto Scaling, 2 EC2 instances would be launched. You would be able to view it in both Active History and EC2 Dashboard

6. Now go to ELB console, you would be able to view both the EC2 has been registered with your ELB.

Verify the status of your EC2 in ELB. It should be In Service

For Out of Service status, troubleshot your EC2 and make sure index.html is present under /var/www/html and web server is up & running

In this case, the AMI was already contained the index.html for web server. So the status changed to InService

7. Now copy your ELB public DNS and hit in the browser, you would be able to see your web server

Now you have set up your Auto Scaling with Load Balancer. This would provide high availability to your application.

I hope this blog helps. Please comment below if you have any concerns related to this blog.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: