Google Professional Cloud Network Engineer Question 411
Select 2Google Cloud PlatformYou are configuring a Google Cloud HTTP(S) Load Balancer for a web application that serves different types of content. The application has the following requirements:
- All requests to the path
/api/*should be routed to a backend service namedapi-backend. - All requests to the path
/static/*should be routed to a backend service namedstatic-backend. - Any other requests should be routed to a default backend service named
default-backend.
How should you configure the URL map to meet these requirements?
- A
Create a URL map with a host rule that matches the domain and path matcher rules for
/api/*,/static/*, and a default route. - B
Create a URL map with a single path matcher that includes path rules for
/api/*,/static/*, and a default route. - C
Configure a URL map with multiple host rules, each with its own path matcher for
/api/*,/static/*, and the default route. - D
Use a single path matcher in the URL map and specify backend services for
/api/*and/static/*, while setting a default backend service for unmatched requests. - E
Create a separate URL map for each path (
/api/*and/static/*) and configure a default backend service in each map.
Show answer and explanation
Correct answers: B, D
Explanation
To configure the URL map for the given requirements, you should use a single path matcher. A path matcher allows you to define specific path rules (e.g., /api/*, /static/*) and associate them with backend services. Additionally, it supports a default backend service for any unmatched requests. This setup is efficient and aligns with Google Cloud's best practices for URL maps, avoiding unnecessary complexity from multiple host rules or separate URL maps.
- A. Incorrect.
Correct, as a single path matcher can handle multiple path rules and a default route, making the configuration simple and efficient.
- B. Correct.
Correct, because using a single path matcher with specific path rules for
/api/*and/static/*along with a default backend service meets the requirements. - C. Incorrect.
Incorrect, as multiple host rules are unnecessary in this scenario. Host rules are used for routing based on domains, not paths.
- D. Correct.
Correct, because a single path matcher simplifies the configuration and allows for specific routing rules and a default backend service for unmatched requests.
- E. Incorrect.
Incorrect, as creating separate URL maps for each path is not a best practice and introduces unnecessary complexity.