Q288. A fast food company is using AWS to host their online ordering system which uses an Auto Scaling group of EC2 instances deployed across multiple Availability Zones with an Application Load Balancer in front. To better handle the incoming traffic from various digital devices, you are planning to implement a new routing system where requests which have a URL of <server>/api/android are forwarded to one specific target group named “Android-Target-Group”. Conversely, requests which have a URL of
<server>/api/ios are forwarded to another separate target group named “iOS-Target-Group”.
How can you implement this change in AWS?
If your application is composed of several individual services, an Application Load Balancer can route a request to a service based on the content of the request such as Host field, Path URL, HTTP header, HTTP method, Query string, or Source IP address. Path-based routing allows you to route a client request based on the URL path of the HTTP header. Each path condition has one path pattern. If the URL in a request matches the path pattern in a listener rule exactly, the request is routed using that rule.

A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters. A-Z, a-z, 0-9
_ – . $ / ~ ” ‘ @ : +
& (using &)
* (matches 0 or more characters) ? (matches exactly 1 character) Example path patterns
/img/*
/js/*
You can use path conditions to define rules that forward requests to different target groups based on the URL in the request (also known as path-based routing). This type of routing is the most appropriate solution for this scenario hence, the correct answer is: Use path conditions to define rules that forward requests to different target groups based on the URL in the request.
The option that says: Use host conditions to define rules that forward requests to different target groups based on the hostname in the host header. This enables you to support multiple domains using a single load balancer is incorrect because host-based routing defines rules that forward requests to different target groups based on the hostname in the host header instead of the URL, which is what is needed in this scenario.
The option that says: Replace your ALB with a Gateway Load Balancer then use path conditions to define rules that forward requests to different target groups based on the URL in the request is incorrect because a Gateway Load Balancer does not support path-based routing. You must use an Application Load Balancer.
The option that says: Replace your ALB with a Network Load Balancer then use host conditions to define rules that forward requests to different target groups based on the URL in the request is incorrect because a Network Load Balancer is used for applications that need extreme network performance and static IP. It also does not support path-based routing which is what is needed in this scenario.
Furthermore, the statement mentions host-based routing even though the scenario is about path-based routing.
References:
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html#application-load-b alancer-benefits
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#path-c onditions Check out this AWS Elastic Load Balancing (ELB) Cheat Sheet:
https://tutorialsdojo.com/aws-elastic-load-balancing-elb/
Application Load Balancer vs Network Load Balancer vs Classic Load Balancer:
https://tutorialsdojo.com/application-load-balancer-vs-network-load-balancer-vs-classic-load-balancer/
Recent Comments