Google Professional Cloud Network Engineer Question 410
Single answerGoogle Cloud PlatformYou are configuring a URL map for your Google Cloud HTTP(S) Load Balancer. Your goal is to send traffic matching the path prefix /api/v1/ to a backend service named api-backend, while all other traffic should go to a default backend service named default-backend. Which configuration step is required to achieve this behavior?
- A
Create a host rule to map the domain to the URL map.
- B
Add a path matcher with a route rule matching
/api/v1/*and set the backend service toapi-backend. - C
Define a default route in the URL map and set the backend service to
default-backend. - D
Add a path matcher with a route rule matching
/api/v1/*and set the backend service todefault-backend.
Show answer and explanation
Correct answer: B
Explanation
To configure a URL map for an HTTP(S) Load Balancer, you need to define path matchers with specific route rules. In this scenario, you must add a path matcher with a route rule for /api/v1/* and associate it with the api-backend service to handle matching traffic. Additionally, a default backend service should be defined to handle all other traffic that doesn't match any explicit path rules. Option 2 correctly addresses the path-specific routing requirement, while the other options either misconfigure or fail to address the scenario.
- A. Incorrect.
Host rules are used to map specific domains or hostnames to path matchers in the URL map. While this might be required in other scenarios, it is not directly needed to solve the specific path routing requirement mentioned in this question.
- B. Correct.
This is the correct step. By using a path matcher with a route rule matching
/api/v1/*and associating it with theapi-backendservice, you can ensure that requests to/api/v1/are routed to the correct backend. - C. Incorrect.
Defining a default route is necessary but not sufficient to solve the specific path routing requirement. The default route will handle traffic that does not match any explicit path rules, but it does not address the
/api/v1/requirement. - D. Incorrect.
This step incorrectly maps
/api/v1/*to thedefault-backend, which contradicts the goal of routing/api/v1/traffic toapi-backend.