SAA-C03 Question 132
Select 3Your company is hosting a web application on Amazon EC2 instances behind an Application Load Balancer (ALB). The application serves different content based on the URL path. For example, requests to '/api/' should route to a set of instances running APIs, while requests to '/static/' should route to instances hosting static files. How can you configure the ALB to achieve this routing behavior?
- A
Define a listener rule to forward requests with the path pattern '/api/*' to a specific target group.
- B
Define a listener rule to forward requests with the path pattern '/static/*' to a specific target group.
- C
Use host-based routing instead of path-based routing, as it is required for this routing behavior.
- D
Create an additional ALB to handle requests to '/static/*' and associate it with the same EC2 instances.
- E
Set up path-based routing rules in the ALB listener to forward requests based on URL path patterns.
Show answer and explanation
Correct answers: A, B, E
Explanation
To achieve the desired routing behavior, you can use the path-based routing feature of an Application Load Balancer. By defining listener rules with specific path patterns (e.g., '/api/' and '/static/'), the ALB can forward requests to appropriate target groups. Host-based routing is not required here because the routing is not based on hostnames. Additionally, a single ALB is sufficient for handling multiple routing rules.
- A. Correct.
Correct: Path-based routing allows the ALB to forward requests with specific path patterns like '/api/*' to designated target groups.
- B. Correct.
Correct: You can define another listener rule to route requests with the path pattern '/static/*' to a different target group.
- C. Incorrect.
Incorrect: Host-based routing is not required for this use case, as the requirement is based on path patterns, not hostnames.
- D. Incorrect.
Incorrect: There is no need to create another ALB. A single ALB can handle multiple path-based routing rules.
- E. Correct.
Correct: Path-based routing rules are a feature of ALB listeners that enable routing based on URL path patterns.