Load balancing is an essential concept in cloud services and applications and is heavily included in AWS Certified Solutions Architect – Associate (SAA-C03) exam. The primary purpose of load balancing is to distribute network traffic evenly across multiple servers to ensure no single server bears too much demand.
We’ll focus primarily on the Application Load Balancer as an important case study of load balancing.
AWS Elastic Load Balancing
AWS provides Elastic Load Balancing service which automatically distributes incoming app traffic across multiple targets, such as Amazon EC2 instances, containers, IP addresses, and Lambda functions. It enhances the availability and fault tolerance of your applications. There are three kinds of Load Balancers AWS is offering:
- Application Load Balancer
- Network Load Balancer
- Classic Load Balancer
Each has its use case, but the most versatile is the Application Load Balancer.
Application Load Balancer (ALB)
The Application Load Balancer, simply known as ALB, operates at the request level (layer 7). It allows you to define routing rules based on the content of the request, making it ideal for modern application architectures, including microservices using container-based operations.
For example, if your microservices are packaged in different containers and each service has a different path like /service1, /service2, etc., you can configure routing rules in ALB to forward requests to the appropriate target group based on the URL path.
Here’s an example of how to create an Application Load Balancer in AWS:
- Navigate to EC2 Dashboard and click on Load Balancers on the left menu panel.
- Click on “Create Load Balancer”.
- Choose “Application Load Balancer” and configure the settings (listeners, security groups, routing, etc.) as per your application needs.
- Finally, click on “Create” to finish.
Advantages
The benefits of using Application Load Balancer include:
- Content-Based Routing: ALB examines the incoming traffic and directs it to the appropriate services based on the content or path.
- Containerized Application Support: It integrates with Amazon ECS, Amazon EKS, AWS Fargate, and AWS Outposts, ensuring seamless container deployment.
- WebSockets and HTTP/2 Traffics: It provides native support for these popular protocols.
Features | Application Load Balancer | Classic Load Balancer |
---|---|---|
Load balancing to multiple ports on the same instance | Yes | No |
Content based routing | Yes | No |
HTTP/2 and WebSockets Support | Yes | No |
Containerized Application Support | Yes | No |
Conclusion
AWS load balancing, particularly the Application Load Balancer, is a powerful tool for managing and distributing network traffic among various servers or services. The features it provides, such as content-based routing, HTTP/2 support, and containerized application support, make it an ideal choice for current application architectures.
For the AWS Certified Solutions Architect – Associate exam, understanding load balancing and how to implement it using AWS services is crucial. AWS documentation and whitepapers provide a detailed guide and more complex scenarios to understand these concepts better. Practice troubleshooting and configuring these services to gain a hands-on experience, which is integral to passing the exam.
Practice Test
True/False: Application Load Balancer operates at the transport layer (Layer 4).
- Answer: False.
Explanation: Application Load Balancer operates at the application layer (Layer 7). It routes traffic to targets, such as Amazon EC2 instances, based on the content of the request.
Which of the following are types of load balancers available in AWS?
- a) Application Load Balancer
- b) Network Load Balancer
- c) Classic Load Balancer
- d) Instance Load Balancer
Answer: a, b, and c.
Explanation: AWS provides three types of load balancers: Application Load Balancer, Network Load Balancer, and Classic Load Balancer. The Instance Load Balancer does not exist.
True/False: Load Balancing is the process of distributing network traffic across multiple servers.
- Answer: True.
Explanation: Load balancing is a technique that distributes workloads uniformly across servers or other compute resources to optimize network efficiency, reliability, and capacity.
What does Sticky Session enabled in Load Balancer do?
- a) Routes each request to a new target.
- b) Keeps the session active even if the instance fails.
- c) Binds a user’s session to a specific target.
- d) Stops the session after a specific target is reached.
Answer: c.
Explanation: Sticky sessions allow the load balancer to bind a user’s session to a specific instance, so all requests from a user during a session are sent to the same target instance.
True/False: Network Load Balancer cannot handle sudden and volatile traffic patterns.
- Answer: False.
Explanation: Network Load Balancer is capable of handling sudden and volatile traffic patterns while using a flow-hash load balancing algorithm for TCP traffic.
What is the form of IP address that Application Load Balancer supports?
- a) Both IPv4 and IPv6
- b) Only IPv4
- c) Only IPv6
- d) None of the above
Answer: a.
Explanation: Application Load Balancer supports both IPv4 and IPv6 addresses.
True/False: Load Balancer does not provide a single point of contact for clients.
- Answer: False.
Explanation: A key feature of load balancer is that it serves as a single point of contact for clients, which increases the availability of your application.
In AWS, a ___ routes individual client connections at the transport level to the healthiest targets with the highest capacity.
- a) Network Load Balancer
- b) Application Load Balancer
- c) Classic Load Balancer
Answer: a.
Explanation: A Network Load Balancer does this task at the transport level based on the health of targets and their capacity.
True/False: Application Load Balancer can route HTTP/S requests to AWS Lambda functions.
- Answer: True.
Explanation: The Application Load Balancer can indeed route HTTP/S requests to AWS Lambda functions, allowing the functions to be triggered with HTTP(S) traffic.
Which of the following Load Balancer operates at the Connection level (Layer 4)?
- a) Network Load Balancer
- b) Application Load Balancer
- c) Classic Load Balancer
Answer: a.
Explanation: Network Load Balancer is designed to handle tens of millions of requests per second while maintaining high throughput at ultra-low latency, with no effort on your part. It operates at the Connection level (Layer 4).
Interview Questions
What is a Load Balancer in AWS?
A Load Balancer in AWS automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances. It ensures that the application has high availability and better performance.
What is an Application Load Balancer?
Application Load Balancer is designed for advanced routing of HTTP/HTTPS (Layer 7) traffic. It provides features like content-based routing, host and path-based routing and als provides native support for microservices and containers.
How do Application Load Balancers route requests?
Application Load Balancers route requests to targets within Amazon VPC based on the content of the request. They evaluate the listener rules in a priority order to determine which rule to apply, and then select a target from the target group for the rule action.
In which of the layer of the OSI model does the application load balancer work?
Application Load Balancer operates at the request level (layer 7) of the OSI model.
What is the concept of Target Groups in relation to Application Load Balancer?
A target group routes requests to one or more registered targets when the rules of a listener determine that the traffic must be routed to that target group. Target group also perform health checks on the targets to ensure that they are able to handle the requests.
Can an Application Load Balancer route requests to targets using multiple ports on the same IP address?
Yes, an Application Load Balancer can route requests to multiple ports on the same IP address.
What is the difference between a Classic Load Balancer and an Application Load Balancer?
Classic Load Balancers operate at both the request level and the connection level. Application Load Balancers operate at the request level (layer 7). They’re best suited for load balancing of HTTP and HTTPS traffic and offer advanced request routing targeted at the delivery of modern application architectures, including microservices and containers.
What is the primary benefit of using a Load Balancer?
The primary benefit of using a Load Balancer is that it improves application availability and redundancy by distributing traffic among multiple instances.
Does an Application Load Balancer also support path-based routing?
Yes, the Application Load Balancer supports path-based routing. This allows the load balancer to forward requests according to the URL path in the request, essentially allowing it to route requests to different services based on the defined rules.
How does AWS Load Balancer handle Health Checks?
AWS Load Balancer periodically sends requests to its registered targets to test their status. If the target fails the health check, it is taken out of service until it passes the health check again.
What happens if an Application Load Balancer fails health check?
If an Application Load Balancer fails health check, it stops routing traffic to the unhealthy targets and reroutes the traffic to healthy targets.
What are some of the protocols supported by the Application Load Balancer?
Application Load Balancer supports HTTP, HTTPS, and WebSocket protocols.
Can an Application Load Balancer also handle SSL offloading?
Yes, an Application Load Balancer supports SSL offloading, which removes the SSL based encryption/decryption work from the backend servers, freeing up resources on those servers.
What are the types of Load Balancers available in AWS?
AWS provides the following types of load balancers: Application Load Balancer, Network Load Balancer and Classic Load Balancer.
Can load balancer be used with AWS Auto Scaling?
Yes, load balancers can be used in conjunction with AWS Auto Scaling to help maintain the application availability during varying load conditions. They can distribute the traffic to healthy instances within the auto scaling groups.