AWS, Internet of Things (IoT)

4 Mins Read

Integration of Amazon EC2 Auto Scaling and Elastic Load Balancer


Software deployment these days expects high availability, scalability, and resilience. Amazon Web Services (AWS) provides us with services that can be easily integrated to achieve the abovementioned objectives of software deployment. Here is a quick glimpse at these AWS services: 

  1. Elastic Load Balancing (ELB) is an AWS service that automatically distributes the incoming application traffic across multiple registered targets such as EC2 instances, containers, and IP addresses that are in one or more Availability Zones (AZs). This will ensure fair distribution of workload, and Elastic Load Balancing in AWS can be configured in four different ways, namely Application Load Balancers (ALB), Network Load Balancers (NLB), Gateway Load Balancers (GLB), and Classic Load Balancers. To create an ALB, we need to configure a target group that allows registering targets such as EC2 instances. Then, we configure an ALB and add listeners which are processes configured with protocol and port combinations that check for connection requests. The load balancer is now active to distribute traffic.
  2. Amazon EC2 Auto Scaling is another very useful AWS service that always ensures that the application server pool has the correct number of Amazon EC2 instances in the form of a collection called Auto Scaling Group (ASG). ASG handles the load of the application. Auto Scaling Group is maintained by specifying the minimum capacity, maximum capacity, and desired capacity. ASG makes sure group size never goes below minimum capacity and never goes above maximum capacity. Desired capacity is specified to ensure that ASG has those many instances when the group is created or any time thereafter. As per the application’s demand, EC2 instances will be launched and terminated automatically as per the scaling policies specified by the user.

So, we can attach Elastic Load Balancer with Auto Scaling group, i.e., register the group with the load balancer so that the load balancer can distribute all the incoming web traffic to the instances part of Auto Scaling group. We need not register individual EC2 instances with the load balancer. Registering and deregistering EC2 instances with the load balancer is automatic as and when the Auto Scaling group scales out and scales in. 

Further, we can configure the Auto Scaling group to either use ELB metrics (such as ALB request count per target) or ELB health checks to decide when to auto-scale. 

 Let us go ahead and understand the steps for integrating Application Load Balancer with Auto Scaling Group. 

Creating an Auto Scaling Group 

Step 1: Choose Auto Scaling Groups from the navigation pane on the left of the Amazon EC2 console. 

Step 2: Click on the button. 

Step 3: Enter a name for the new group. 

Step 4: Choose the Launch Template (if one exists) or create a new Launch Template from the link on the AWS management console. 

Note: a launch template is a saved and version-controlled instance configuration that can be used to launch EC2 instances, and can be reused and shared. 

Step 5: Fill up the Launch template contents like name, Application, and OS Images (Amazon Machine Image). Instance type, key pair, network settings (need not be included in template), and then click on to create the template. 

Step 6: Use the launch template created in Step 5, specify the version and click on  

Step 7: If you haven’t specified network settings and instance type in the launch template, you can set it now. Choose the VPC network environment where your instances will be launched and customize the instance types and purchase options. Click on  

Note: Use multiple Availability Zones for high availability. 

Note: In the Instance type requirements section, we can keep the same instance attributes or instance type from the chosen launch template, or we can override the launch template by specifying different instance attributes or manually adding instance types. If we specify our compute requirements in virtual CPUs (vCPUs) and memory, a list of matching instance types is displayed, which can be previewed, and a specific instance type matching our compute and memory requirements can be chosen. 

Note: Instance purchase options can be used to specify a mix of On-Demand and Spot Instances. 

Step 8: We need to attach this Auto Scaling group to an existing load balancer or to a new load balancer that we can define instantly or choose not to attach to a load balancer. 

We just need to select the load balancer that we have already created if we choose from an existing load balancer. 

If we create a new load balancer and attach it, then we need to specify the Load balancer type, name, and scheme (internal or internet-facing). Click on  

Note: The new load balancer we are creating will be using the same VPC and Availability Zone as selected for our Auto Scaling group. We can anyways select different subnets and add subnets from additional Availability Zones. 

Note: When we are creating just a load balancer, we need to make sure that we select multiple AZs and make sure the EC2 instances attached as targets get created in those selected AZs, else load balancer cannot distribute traffic, and you will get the the the errors. 

Note: By default, a listener to listen on port 80 for HTTP traffic will be created as we create a load balancer, and Default routing would be to forward to a target group (existing or new). If we need other listeners, we can create them from the load-balancing console. 

Note: Health checks and monitoring options being optional, we can configure, if required 

Step 9: Now, we need to Configure group size and scaling policies (both are optional, but setting the minimum, maximum, and desired capacities and the scaling policy will dynamically resize the Auto Scaling group depending on the changes in demand). 

Refer: Dynamic scaling for Amazon EC2 Auto Scaling – Amazon EC2 Auto Scaling 

Step 10: Add notifications and Tags (optional)  

whenever Amazon EC2 Auto Scaling launches or terminates the EC2 instances in the Auto Scaling group, we can add notifications to SNS topics. 

Tags help to search, filter, and track the Auto Scaling group across AWS. So, we can add tags that can be automatically assigned to EC2 instances. 

Final Step: To review the whole setup – as displayed on the AWS management console. 

Step 1: Choose the launch template or configuration. 

Step 2: Choose instance launch options. 

Step 3: Configure advanced options. 

Step 4: Configure group size and scaling policies. 

Step 5: Add notifications. 

Step 6: Add tags. 

We can edit any settings at this point if required, and then go ahead and click on  


This would create an Auto Scaling group, the desired capacity of EC2 instances, listener, target group, security group for ALB, and Application Load Balancer 

Customized Cloud Solutions to Drive your Business Success

  • Cloud Migration
  • Devops
  • AIML & IoT
Know More

Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.

  • Cloud Training
  • Customized Training
  • Experiential Learning
Read More

About CloudThat

Incepted in 2012 is the first Indian organization to offer Cloud training and consultancy for mid-market and enterprise clients. Our business goal is to provide global services on Cloud Engineering, Cloud Training, and Cloud Expert Line. The expertise in all major cloud platforms including Microsoft Azure, Amazon Web Services (AWS), VMware, and Google Cloud Platform (GCP) position us as pioneers in the realm. 




    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!