Update Configurations for Load Balancer
Tags: awscommunitybuilders, aws, iug, cloudskills
Published: 2022-09-30 09:22:01

**Outline**



** What is Load Balancing?
 Types of Load Balancer
 Target Group and load balancer
 Update Availability Zones using the console:
 Update Security groups for Application Load Balancer
 Update the IP address type of Load Balancer:
 Load Balancer Tags
 Delete Application Load Balancer**





**What is Load Balancing?**

Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers, also known as a server farm or server pool. Modern high-traffic websites must serve hundreds of thousands, if not millions, of concurrent requests from users or clients and return the correct text, images, video, or application data, all in a fast and reliable manner. To cost-effectively scale to meet these high volumes, modern computing best practice generally requires adding more servers.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hungyag5p5ph8k3wp9ji.png)



A Load Balancer acts as the “traffic cop” sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked, which could degrade performance. If a single server goes down, the load balancer redirects traffic to the remaining online servers. When a new server is added to the server group, the load balancer automatically starts to send requests to it.


In this manner, a load balancer performs the following functions:

• Distributes client requests or network load efficiently across 
  multiple servers.
• Ensures high availability and reliability by sending requests 
  only to servers that are online.
• Provides the flexibility to add or subtract servers as demand 
  dictates.


**Benefits of Load Balancer**

Redirecting traffic to the most operational server at the time has the following benefits:

**Big Data**

   Actionable insights from big data provided by worldwide users can be examined to help businesses make better, more informed decisions.

**Improve Efficiency**

   Load Balancers lessen the increased load on a server and maintain smooth operations and responses, providing a better experience for customers.

**Predictive Analysis**

  Traffic bottlenecks can be predicted by software load balancers before they occur in the real
world.


**Resilience**

With little or no downtime, the defective and under-performing components can be replaced promptly, providing information on which equipment needs service.

**Security**

Load Balancer adds an extra layer of security to your website and applications without requiring any changes.
  
**Scalability**

Load Balancers allow you to change the server infrastructure at any time without impacting
services.


**Types of Load Balancer**

AWS offers three types of load balancers, adapted for various scenarios:

**• Elastic Load Balancers**

Classic Load Balancer provides basic load balancing across multiple Amazon EC2 instances and operates at both the request level and connection level. Classic Load Balancer is intended for applications that are built within the EC2-Classic network.

**• Application Load Balancers**

Application Load Balancer operates at the request level (layer 7), routing traffic to targets (EC2 instances, containers, IP addresses, and Lambda functions) based on the content of the
request. Ideal for advanced load balancing of HTTP and HTTPS traffic, Application Load Balancer provides advanced request routing targeted at delivery of modern application architectures, including microservices and container-based applications. Application Load Balancer simplifies and improves the security of your application, by ensuring that the latest SSL/TLS ciphers and protocols are used at all times.

**• Network Load Balancers**

Network Load Balancer operates at the connection level (Layer 4), routing connections to targets (Amazon EC2 instances, microservices, and containers) within Amazon VPC, based on IP protocol data. Ideal for load balancing of both TCP and UDP traffic, Network Load Balancer is capable of handling millions of requests per second while maintaining ultra-low latencies. Network Load Balancer is optimized to handle sudden and volatile traffic patterns while using a single static IP address per Availability Zone. It is integrated with other popular AWS services such as Auto Scaling, Amazon EC2 Container Service (ECS), Amazon CloudFormation, and AWS Certificate Manager (ACM).


**• Gateway Load Balancers**

Gateway Load Balancer helps you easily deploy, scale, and manage your third-party virtual appliances. It gives you one gateway for distributing traffic across multiple virtual appliances while scaling them up or down, based on demand. This decreases potential points of failure in your network and increases availability.


**Target Group and load balancer**

Target groups are just a group of Ec2 instances. Target groups are closely associated with ELB and not ASG. We can just use ELB and Target groups to route requests to EC2 instances. With
this setup, there is no auto scaling which means instances cannot be added or removed when your load increases/decreases.
A target group tells a load balancer where to direct traffic to : EC2 instances, fixed IP addresses; or AWS Lambda functions, amongst others. When creating a load balancer, you create one or more listeners and configure listener rules to direct the traffic to one target group.


To create a load balancer and target group, see the article:

https://dev.to/zahraajawad/how-to-create-load-balancer-hef

Some configurations for creating a load balancer can be changed or update after creation
such as :
• Availability Zones
• Security Group
• IP address type
• Load Balancer Tags.


**AWS Availability Zones of Load Balancer**

Availability Zones are distinct locations within an AWS Region that are engineered to be isolated from failures in other Availability Zones. They provide inexpensive, low-latency network connectivity to other Availability Zones in the same AWS Region. Each region is completely independent. It can enable or disable the Availability Zones for a load balancer at any time. After enabling an Availability Zone, the load balancer starts routing requests to the registered targets in that Availability Zone. The load balancer is most effective if you ensure that each enabled Availability Zone has at least one registered target. After you disable an Availability Zone, the targets in that Availability Zone remain registered with the load balancer, but the load balancer will not route requests to them. 


**Update Availability Zones using the console:**
   
1. Open the Amazon EC2 console at 
   https://console.aws.amazon.com/ec2/.
2. On the navigation pane, under LOAD BALANCING, choose Load 
   Balancers.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c8e0h2le9hiko8ab0hvu.png)


3. Select the load balancer.
4. On the Description tab, under Basic Configuration.
5. Choose Edit subnets.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w21gnuncbg0e4uw8n37m.png)


6. To enable a zone, select the check box for that zone and select 
   one subnet. If there is only one subnet for that zone, it is 
   selected. If there is more than one subnet for that zone, 
   select one of the subnets.
7. To remove an Availability Zone, clear the check box for that 
   Availability Zone.
8. Choose **Save**.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1yvv7pi53kk4suo4v1j.png)


**Update Security groups for Application Load Balancer**

An AWS security group acts as a virtual firewall for the EC2 instances to control incoming and outgoing traffic. Both inbound and outbound rules control the flow of traffic to and traffic from the instance, respectively. AWS Security Groups have a set of rules that filter traffic in two ways: **inbound and outbound**. Since AWS security groups are assigned differently, you won't be needing the same rules for both inbound and outbound traffic. Security group rules enable you to filter traffic based on protocols and port numbers. Security groups are stateful—if you send a request from your instance, the response traffic for that request is allowed to flow in regardless of inbound security group rules.

**To update Security groups for Application Load Balancer**

1. On the **Description** tab, under Security, choose **Edit security groups**.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2indo99nbx3wq07j7xlf.png)

2. To associate a security group with the load balancer, select check box for it. Or to remove a security group from the load balancer, clear it.
3. Choose **Save**.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pqqv1c11555portg3tjv.png)


**Update Security Groups for Application Load Balancer**

You can configure your Application Load Balancer so that clients can communicate with the load balancer using IPv4 addresses only, or using both IPv4 and IPv6 addresses (dualstack). The load balancer communicates with targets based on the IP address type of the target group. 

Dualstack requirements

• You can set the IP address type when you create the load balancer 
  and update it at any time.
• The virtual private cloud (VPC) and subnets that you specify for 
  the load balancer must have associated IPv6 CIDR blocks. For more 
  information .
• The route tables for the load balancer subnets must route IPv6 
  traffic.
• The security groups for the load balancer must allow IPv6 
  traffic.
• The network ACLs for the load balancer subnets must allow IPv6 
  traffic.


**To update the IP address type of Load Balancer:**

1. Select the load balancer.
2. Choose **Actions**.
3. Choose **Edit IP address type**.
4. For **IP address type**, choose **ipv4** to support IPv4 addresses only or **dualstack** to support
both IPv4 and IPv6 addresses.
5. Choose **Save**.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zfmwbbzmz9cdleiv64ax.png)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uuda7wpy7723qew4tg2m.png)



**Load Balancer Tags**

You can apply tags to your Load Balancer resources to help you organize them according to your business needs. Apply tags at the time you create a network load balancer, or update the network load balancer with tags later.

**Restrictions**

• Maximum number of tags per resource—50
• Maximum key length—127 Unicode characters
• Maximum value length—255 Unicode characters
• Tag keys and values are case sensitive. Allowed characters are 
  letters, spaces, and numbers representable in UTF-8, plus the 
  following special characters: + - = . _ : / @. Do not use 
  leading or trailing spaces.
• Do not use the aws: prefix in your tag names or values because i 
  is reserved for AWS use. You can't edit or delete tag names or 
  values with this prefix. Tags with this prefix do not count 
  against your tags per resource limit.


**To update the tags for a load balancer using the console:**

1. Select the load balancer.
2. On the **Tags** tab, choose **Add/Edit Tags**.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3vxemurvprdowvlvhskd.png)


When choose **Add/Edit Tags**. do one or more of the following:

1. To update a tag, edit the values of **Key** and **Value**.
2. To add a new tag, choose **Create Tag** and then enter values 
   for **Key** and **Value**.
3. To delete a tag, choose the delete icon (X) next to the tag.

When finished updating tags, choose **Save**.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e43drquyl8jg64fwacz3.png)


**Delete an Application Load Balancer**

As soon as your load balancer becomes available, you are billed for each hour or partial hour that you keep it running. When you no longer need the load balancer, you can delete it. As soon as the load balancer is deleted, you stop incurring charges for it.

**To delete a load balancer using the console:**

When prompted for confirmation, choose **Yes, Delete**



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mqmuoh9kgk825dkk60wm.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d409i90conyrxx15haq9.png)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfg51pujp11b0v5vnbt2.png)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1lmj3g75avldfzgrtq08.png)


The Load Balancer is deleted.