Support Documents
No data found.

Understanding AWS ALB Path Based Routing

Lab Details

  1. This lab walks you through the creation of two Amazon EC2 instances with Apache web server installed and both servers will contain HTML pages that can be accessed publicly. Next you will create an Application Load Balancer which distributes incoming traffic across 2 Amazon EC2 instances and also add path based routing in the ELB.

  2. You will be practicing this lab using the Amazon EC2 and AWS ELB services.

  3. Duration: 90 minutes

  4. AWS Region: US East (N. Virginia) us-east-1


What is Path-Based Routing?

  • Application Load Balancer offers unique features over Classic ELB and one of the features is Path-based Routing.

  • ALB forwards the incoming requests to different destinations based on the path you mention in the uri.

  • Create listeners with rules that forward requests to target groups based on the URL.

What is Elastic Load Balancing?

  • ELB is a service that automatically distributes incoming application traffic and scales resources to meet traffic demands.

  • ELB helps in adjusting capacity according to incoming application and network traffic.

  • ELB can be enabled within a single availability zone or across multiple availability zones to maintain consistent application performance.

  • ELB offers features like:

  • Detection of unhealthy EC2 instances.

  • Spreading EC2 instances across healthy channels only.

  • Centralized management of SSL certificates.

  • Optional public key authentication.

  • Support for both IPv4 and IPv6.

  • ELB accepts incoming traffic from clients and routes requests to its registered targets.

  • When an unhealthy target or instance is detected, ELB stops routing traffic to it and resumes only when the instance is healthy again.

  • ELB monitors the health of its registered targets and ensures that the traffic is routed only to healthy instances.

  • ELB's are configured to accept incoming traffic by specifying one or more listeners. A listener is a process that checks for connection requests.

  • Listeners are configured with a protocol and port number from client to the ELB, and vise-versa i.e., back from ELB to target.

  • ELB supports 3 types of load balancers:

    •  Application Load Balancers

    • Network Load Balancers

    • Classic Load Balancers

  • Each load balancer is configured differently.

  • For Application and Network Load Balancers, you register targets in target groups and route traffic to target groups.

  • For Classic Load Balancers, you register instances with the load balancer.

  • AWS recommends users to work with Application Load Balancer to use multiple Availability Zones because if one availability zone fails, the load balancer can continue to route traffic to the next available one.

  • We can have our load balancer be either internal or internet-facing.

  • The nodes of an internet-facing load balancer have Public IP addresses, and the DNS name is publicly resolvable to the Public IP addresses of the nodes.

  • Due to the point above, internet-facing load balancers can route requests from clients over the Internet.

  • The nodes of an internal load balancer have only Private IP addresses, and the DNS name is publicly resolvable to the Private IP addresses of the nodes.

  • Due to the point above, internal load balancers can only route requests from clients with access to the VPC for the load balancer.

  • Both internet-facing and internal load balancers route requests to your targets using Private IP addresses.

  • Your targets do not need Public IP addresses to receive requests from an internal or an internet-facing load balancer.

What is Amazon EC2?

  • AWS defines it as Elastic Compute Cloud.

  • It’s a virtual environment where “you rent” to have your environment created, without purchasing.

  • Amazon refers to these virtual machines as Instances.

  • Preconfigured templates can be used to launch instances. These templates are referred to as images. Amazon provides these images in the form of AMIs (Amazon Machine Images).

  • Allows you to install custom applications and services.

  • Scaling of infrastructure i.e., up or down is easy based on the demand you face.

  • AWS provides multiple configurations of CPU, memory, storage etc., through which you can pick the flavor that's required for your environment.

  • No limitation on storage. You can pick the storage based on the type of the instance that you are working on.

  • Temporary storage volumes are provided, which are called Instance Store Volumes.  Data stored in this gets deleted once the instance is terminated.

  • Persistent storage volumes are available and are referred to as EBS (Elastic Block Store) volumes.

  • These instances can be placed at multiple locations which are referred to as Regions and Availability Zones (AZ).

  • You can have your Instances distributed across multiple AZs i.e., within a single Region, so that if an instance fails, AWS automatically remaps the address to another AZ.

  • Instances deployed in one AZ can be migrated to another AZ.

  • To manage instances, images, and other EC2 resources, you can optionally assign your own metadata to each resource in the form of tags.

  • A Tag is a label that you assign to an AWS resource.  It contains a key and an optional value, both of which are defined by you.

  • Each AWS account comes with a set of default limits on the resources on a per-Region basis.

  • For any increase in the limit you need to contact AWS.

  • To work with the created instances, we use Key Pairs.

Architecture Diagram

Task Details

  1. Launching Lab Environment.

  2. Launching two EC2 Instances using Bash script.

  3. Create an application Load Balancer.

  4. Configure Path Based Routing.

  5. Test the ELB configuration.

  6. Validation of the Lab.

  7. Deleting AWS Resources.