Concepts

For those studying to become an AWS Certified Solutions Architect – Associate, understanding the concepts of load balancing and how to implement them using AWS services such as the Application Load Balancer (ALB) is vital.

What is Load Balancing?

Load balancing is the process of distributing network traffic across multiple servers. This distribution ensures that no single server bears too much demand. By spreading the load, load balancing helps to improve responsiveness and increases the availability of applications and services.

Types of Load Balancers on AWS

AWS offers several types of load balancers, each designed to suit different use cases:

  • Classic Load Balancer (CLB): Offers basic load balancing across multiple EC2 instances.
  • Application Load Balancer (ALB): Operates at the request level (Layer 7), routing traffic to targets within Amazon EC2 instances, containers, and IP addresses based on the content of the request.
  • Network Load Balancer (NLB): Operates at the connection level (Layer 4), routing connections to targets within Amazon EC2 instances, containers, and IP addresses.
  • Gateway Load Balancer (GWLB): Combines the functionality of a transparent network gateway with a load balancer.

Application Load Balancer (ALB) Concepts

The Application Load Balancer is suitable for load balancing HTTP and HTTPS traffic, providing advanced request routing targeted at modern application architectures, including microservices and containers.

Key Features of ALB:

  • Content-Based Routing: ALB can route requests based on content, enabling it to send requests to different backend services based on the requested URL or hostname.
  • Host-Based Routing: Allows routing decisions to be made based on the host field of the HTTP header.
  • Path-Based Routing: Enables the routing of requests based on URL paths.
  • HTTP/2 and WebSocket Support: ALB supports these protocols to improve performance.
  • Native IPv6 Support: ALB can operate in dual-stack mode, processing both IPv4 and IPv6 traffic.

Target Groups

ALB routes traffic to targets grouped into target groups based on rules. A single ALB can have multiple listeners with rules to different target groups.

High Availability

To ensure high availability, ALBs are designed to be fully distributed across the AWS network and can automatically scale with the incoming traffic.

Health Checks

ALB health checks monitor the health of the resources (such as EC2 instances) in the target groups, and route traffic only to the healthy ones.

Example: Creating an Application Load Balancer

Below is an example of how you might configure an ALB for a web application using the AWS Management Console:

  1. Define Load Balancer:
    • Navigate to the EC2 Dashboard and select Load Balancers.
    • Click “Create Load Balancer” and choose “Application Load Balancer.”
    • Configure the LB settings, including name, scheme (internet-facing or internal), and listeners (typically HTTP on port 80 and HTTPS on port 443).
  2. Configure Security Settings:
    • If you are using HTTPS, you will need to upload an SSL certificate or use one from AWS Certificate Manager.
  3. Configure Routing:
    • Create a target group, defining protocol, port, health check settings, and which instances it should include.
  4. Register Targets:
    • Add the EC2 instances that will serve the traffic, or specify the IP addresses or Lambda functions.
  5. Review and Create:
    • Review the configuration and create the load balancer.
    • Update the security groups of your instances to allow traffic from the ALB.

After this process, the ALB will automatically distribute incoming traffic based on the defined rules and health check status of the targets.

Comparison of Load Balancers on AWS

Feature/Load Balancer Classic Load Balancer Application Load Balancer Network Load Balancer Gateway Load Balancer
Traffic Type HTTP, HTTPS, TCP, SSL HTTP, HTTPS TCP, TLS, UDP, TCP_UDP L3
Routing Capabilities Limited Content-based Connection-based Transparent
Performance Good Better (with HTTP/2) Best (low latency) Good
Health Checks EC2 instances Target level (mult. entities) Target level (mult. entities) Endpoint level
Typical Use Cases Simple load balancing Advanced HTTP/S routing High-performance, static IP Network/Security Functions

Understanding these different types of load balancers and when to use each is an essential part of architecting solutions on AWS. The Application Load Balancer, with its advanced routing capabilities and support for modern application architectures, is often a good choice for developers looking to route traffic at the application level.

Answer the Questions in Comment Section

An Application Load Balancer operates at which OSI layer?

  • A) Transport
  • B) Presentation
  • C) Application
  • D) Session
  • E) Network

Answer: C) Application

Explanation: An Application Load Balancer operates at the OSI application layer, which is Layer It can inspect HTTP/HTTPS traffic and make routing decisions based on content.

True or False: Application Load Balancer supports path-based routing.

Answer: True

Explanation: Application Load Balancer supports path-based routing, allowing you to define rules for routing traffic based on the URL path specified in a request.

What is the primary function of a load balancer in AWS?

  • A) Encrypting data
  • B) Storing data
  • C) Distributing traffic across multiple targets
  • D) Compressing data

Answer: C) Distributing traffic across multiple targets

Explanation: The primary function of a load balancer in AWS is to distribute incoming application traffic across multiple targets, such as EC2 instances, containers, and IP addresses.

Which feature enables the Application Load Balancer to direct requests to different back-end services based on the requested HTTP(S) host and path?

  • A) SSL Termination
  • B) Host-based routing
  • C) Sticky sessions
  • D) Cross-zone load balancing

Answer: B) Host-based routing

Explanation: Host-based routing on an Application Load Balancer allows requests to be routed to different back-end services based on the domain name specified in the host header.

True or False: Sticky sessions can be used with an Application Load Balancer to bind a user’s session to a specific target.

Answer: True

Explanation: Sticky sessions (also known as session affinity) can be enabled for an Application Load Balancer, allowing a user’s session to be bound to a specific target.

Which of the following statements are true regarding Application Load Balancers? (Select TWO)

  • A) They support only IPv4 traffic.
  • B) They can route traffic to multiple HTTP applications across machines (targets).
  • C) They only support HTTP and HTTPS listeners.
  • D) They can’t modify headers or add new headers to the HTTP request.

Answer: B) They can route traffic to multiple HTTP applications across machines (targets).

C) They only support HTTP and HTTPS listeners.

Explanation: Application Load Balancers can route traffic to multiple HTTP applications across different targets and only support HTTP and HTTPS protocols. Additionally, ALBs can indeed modify headers with HTTP header modification rules.

What mechanism does an Application Load Balancer use to ensure requests are distributed evenly to the underlying instances across all available Availability Zones?

  • A) Cross-zone load balancing
  • B) Weighted round-robin
  • C) Least outstanding requests
  • D) Cross-region load balancing

Answer: A) Cross-zone load balancing

Explanation: Cross-zone load balancing allows the Application Load Balancer to distribute incoming requests evenly across all registered instances in all enabled Availability Zones.

True or False: Application Load Balancers can be used to route traffic to AWS Lambda functions.

Answer: True

Explanation: Application Load Balancers can be configured to route traffic directly to AWS Lambda functions, allowing serverless architectures to be load balanced.

Which of the following AWS services can Application Load Balancers target to forward traffic to?

  • A) Amazon RDS
  • B) Amazon S3
  • C) AWS Lambda
  • D) Amazon EC2
  • E) Amazon ECS

Answer: C) AWS Lambda, D) Amazon EC2, E) Amazon ECS

Explanation: Application Load Balancers can forward traffic to Amazon EC2 instances, AWS Lambda functions, and Amazon ECS services. They cannot directly forward traffic to Amazon RDS or Amazon S

True or False: An Application Load Balancer can only be deployed within a single Availability Zone.

Answer: False

Explanation: An Application Load Balancer can be deployed across multiple Availability Zones, providing high availability and fault tolerance.

When using an Application Load Balancer, which HTTP-based routing method allows the distribution of traffic based on user-defined URL query parameters?

  • A) Header-based routing
  • B) Path-based routing
  • C) Query-string parameter routing
  • D) Source IP-based routing

Answer: C) Query-string parameter routing

Explanation: Query-string parameter routing allows an Application Load Balancer to route traffic based on the query strings present in the URL, which are the key-value pairs following the “?” in a URL.

What is the purpose of health checks in the context of an Application Load Balancer?

  • A) To determine the geographical location of the users
  • B) To monitor the performance of the load balancer itself
  • C) To check the availability of the web servers behind the load balancer
  • D) To manage the SSL certificates on the load balancer

Answer: C) To check the availability of the web servers behind the load balancer

Explanation: Health checks are performed by the Application Load Balancer to verify that the instances or endpoints behind it are healthy and can receive traffic. If an instance fails health checks, it is removed from the rotation until it passes health checks again.

0 0 votes
Article Rating
Subscribe
Notify of
guest
29 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Jennie Aarskog
5 months ago

Great post on load balancing concepts! Very helpful for my SAA-C03 exam prep.

Vukan Milovanović
8 months ago

This blog post on load balancing using AWS Application Load Balancer is very enlightening!

Claudine Freitas
6 months ago

Thanks for the informative post. It really cleared up my doubts regarding ALBs!

Xisto Monteiro
8 months ago

Could someone explain how target group stickiness works in ALBs?

Sacha Gaillard
6 months ago

The detailed steps for setting up an ALB are greatly appreciated. Thank you!

Anzhela Demchuk
8 months ago

Can we use ALB for both HTTP and HTTPS traffic?

Julcenira Santos
6 months ago

Great post! Just started learning about AWS load balancing and this helps a lot.

Aatu Halonen
8 months ago

Fantastic write-up on the AWS Application Load Balancer! Keep up the good work!

29
0
Would love your thoughts, please comment.x
()
x