Voiced by Amazon Polly |
Overview
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:
- 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.
- 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
Customized Cloud Solutions to Drive your Business Success
- Cloud Migration
- Devops
- AIML & IoT
Outcome
This would create an Auto Scaling group, the desired capacity of EC2 instances, listener, target group, security group for ALB, and Application Load Balancer
Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.
- Cloud Training
- Customized Training
- Experiential Learning
About CloudThat
CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.
CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 850k+ professionals in 600+ cloud certifications and completed 500+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, AWS GenAI Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, Amazon ECS Service Delivery Partner, AWS Glue Service Delivery Partner, Amazon Redshift Service Delivery Partner, AWS Control Tower Service Delivery Partner, AWS WAF Service Delivery Partner, Amazon CloudFront Service Delivery Partner, Amazon OpenSearch Service Delivery Partner, AWS DMS Service Delivery Partner, AWS Systems Manager Service Delivery Partner, Amazon RDS Service Delivery Partner, AWS CloudFormation Service Delivery Partner, AWS Config, Amazon EMR and many more.
WRITTEN BY Aparna R
Comments