Google Professional Cloud Network Engineer Question 412
Select 2Google Cloud PlatformYou are configuring a URL map for a Google Cloud HTTP(S) Load Balancer to route traffic based on request paths. The application has the following requirements:
- Requests to
/api/*should be routed to a backend service namedapi-backend. - Requests to
/static/*should be routed to a backend bucket namedstatic-bucket. - All other requests should be routed to a backend service named
default-backend.
How should you configure the URL map to meet these requirements?
- A
Create a path matcher with a path rule to route
/api/*toapi-backend, a path rule to route/static/*tostatic-bucket, and setdefault-backendas the default route. - B
Configure a single path matcher with a path rule to route
/api/*toapi-backend, and setdefault-backendas the fallback for all other traffic. Route/static/*separately in a different path matcher. - C
Create a path matcher with two path rules: one to route
/api/*toapi-backendand another to route/static/*tostatic-bucket. Specifydefault-backendas the default backend to handle all remaining traffic. - D
Use a default route to handle all traffic with
default-backend, and configure a backend bucket for/static/*. No additional path rules are needed. - E
Configure two separate URL maps: one to handle
/api/*traffic and another to handle/static/*traffic. Usedefault-backendonly in the second URL map.
Show answer and explanation
Correct answers: A, C
Explanation
To meet the requirements, you must use a single URL map with a single path matcher. The path matcher should include path rules to route /api/* to api-backend and /static/* to static-bucket. Additionally, the default backend should be set to default-backend to handle all other unmatched traffic. Options 1 and 3 correctly describe this configuration, while the other options either misrepresent URL map capabilities or propose unnecessarily complex setups.
- A. Correct.
Correct: This option correctly describes the process of creating a single path matcher with path rules for both
/api/*and/static/*, while usingdefault-backendas the fallback for all unmatched traffic. - B. Incorrect.
Incorrect: URL maps do not support multiple path matchers within the same map. You cannot route
/static/*separately in a different path matcher within the same URL map. - C. Correct.
Correct: This option also correctly describes the creation of a single path matcher with two path rules for
/api/*and/static/*, and a default backend for unmatched traffic. - D. Incorrect.
Incorrect: While this option mentions using a default route for unmatched traffic, it does not correctly describe how path rules should be configured for
/api/*and/static/*. A default backend alone cannot handle complex routing requirements. - E. Incorrect.
Incorrect: Using separate URL maps is not appropriate for this scenario. A single URL map can handle all the routing requirements with proper configuration, making this approach overly complex and unnecessary.