Open In App

How To Integrate AWS Auto Scaling With Classical Load Balancer ?

Last Updated : 20 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Auto Scaling is a service in Amazon Web Services (AWS) with the help of an EC2 instance that automatically changes the number of instances as per the user’s application demand. this nature of auto-scaling helps to achieve high availability for an application without any high cost.

The elasticity feature of auto-scaling allows users to scale up and down their application resources based on predefined attributes like desired capacity, minimum capacity, and maximum capacity. This ultimately helps applications manage user traffic coming to them without disturbing the overall working of the application.

What Is Load Balancing?

A Load Balancer as the name suggests balances the load coming on the application component, in cloud platforms like Amazon Web Services (AWS), it distributes incoming network traffic to multiple servers. the main goal of the load balancer is to improve the availability, scalability, and reliability of applications by fairly distributing network traffic and preventing any one server from becoming overloaded, therefore this will improve the overall application performance.

The load balancer is attached to an application in such a way that it faces firstly the network traffic so it can able to distribute it efficiently.

Integration Of AWS Auto Scaling With Classical Load Balancer: A Step-By-Step

Step 1: Log in to AWS Console: Go to the AWS Management Console and log in to your AWS account.

Step 2: Navigate to EC2 Console under elastic load balancer, Firstly Create Load Balancer

Step 3: Create Classical Load Balancer Enter Details like the load balancer name.

classic-load-balancer

lb-1

Step 4: Select Default VPC or you can select your own created one and at least two availability zones.

lb2

Step 5: Select Default Security Group or Either You select your own created.

lb3

Step 6: Register your instances to classical load balancer

lb4-(1)-(1)

Step 7: You can select the additional features which can associated with the load balancer

lb5-(1)

Step 8: Click on Create load balancer

lb6-(1)

Step 9: Create Auto Scaling Group, Go to auto scaling in ec2 console and click on create scaling group, then enter the name of auto scaling group and select the launch template for auto scaling

as1

Step 10: In Choose Instance launch options, select VPC and availability zones for auto scaling group

as2

Step 11: In load balancing, select existing load balancer name and select the classic load balancer we earlier created.

as3

Step 12: In Configure group size and scaling, enter your desired, minimum and maximum capacity for auto scaling.

as4-(1)

Step 13: Select other options as by default and Click on next and click on create auto scaling

as5-(1)

as6

Step 14: We are now successfully integrated auto scaling with classical load balancer now to verify we will test our application, copy the ip address of ec2 instance and paste it in browser.Page returned by Linux 1 Machine

lb-7

Page returned by Linux 3 Machine

lb8

Note: To get the similar output like above paste the following script in user data while creating in ec2 instance

#!/bin/bash

yum install httpd -y

service httpd start

chkconfig httpd on

mkdir /var/www/html

echo ‘Hey!! this is my first website on Linux!’ > /var/www/html/index.html

Advantages Of Auto Scaling With Classical Load Balancer

  • Automatic Resource Management: Auto Scaling automatically adds or removes EC2 instances (virtual servers) based on the incoming traffic to application. The Classic Load Balancer helps distribute this traffic evenly across all the available instances.
  • High Availability: The Classic Load Balancer spreads the incoming traffic across multiple instances in different data centers (Availability Zones). This way, if one instance or data center fails, application remains accessible through the other instances.
  • Health Monitoring: The Classic Load Balancer continuously checks if the instances are healthy and working correctly. If an instance is not responding, the Load Balancer stops sending traffic to it.
  • Scalability: As your application receives more traffic, Auto Scaling launches new instances, and the Classic Load Balancer distributes the traffic across all instances, ensuring application can handle the increased workload.

Disadvantages Of Auto Scaling With Classical Load Balancer

  • Limited Features: Classic Load Balancers have fewer advanced features compared to newer load balancer options from AWS like Application Load Balancer. They may not support certain types of applications or workloads that require more advanced routing or handling.
  • Performance Limitations: Classic Load Balancers operate at a lower level (network and transport layers), which means they cannot inspect or route traffic based on the application’s content or data. This can limit performance optimization for certain applications.
  • Limited Services Support: Classic Load Balancers were designed mainly for traditional virtual servers (EC2 instances) and do not provide built-in support for other services like lamda, EKS, ECS etc.
  • Basic Monitoring: Classic Load Balancers offer only basic monitoring and logging capabilities, making it harder to get detailed insights into application’s performance and traffic patterns.
  • Older Technology: Classic Load Balancers are an older technology, and while AWS still supports them, they may not receive as many new features or improvements as the newer load balancer options

How To Integrate AWS Auto Scaling With Classical Load Balancer – FAQ’s

How does the Classic Load Balancer handle newly launched instances?

When Auto Scaling launches new instances, it automatically registers them with the associated Classic Load Balancer

How does the Classic Load Balancer handle terminated instances?

When Auto Scaling terminates instances, it automatically deregisters them from the associated Classic Load Balancer.

How can I monitor the performance of the Auto Scaling and Classic Load Balancer integration?

AWS CloudWatch provides various metrics and alarms for monitoring both Auto Scaling and Classic Load Balancers.

Can I use Auto Scaling with multiple Classic Load Balancers?

Yes, you can associate an Auto Scaling group with multiple Classic Load Balancers.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads