Complete the code to create a URL map that directs traffic to a backend service.
gcloud compute url-maps create my-url-map --default-service [1]The --default-service flag requires the name of a backend service to route traffic to. Using an instance group, firewall rule, or network is incorrect here.
Complete the code to add a path matcher to the URL map for routing based on URL paths.
gcloud compute url-maps add-path-matcher my-url-map --default-service my-backend-service --path-matcher-name [1] --path-rules "/images/*=image-backend,/videos/*=video-backend"
The --path-matcher-name flag requires a custom name for the path matcher. 'path-matcher-1' is a valid descriptive name.
Fix the error in the command to create a URL map with a host rule.
gcloud compute url-maps create my-url-map --default-service my-backend-service --host-rules [1]The --host-rules flag requires the value to be quoted and use the plural 'hosts' key. The correct format is a quoted string with 'hosts=' and 'pathMatcher=' keys.
Fill both blanks to define a URL map with a host rule and a path matcher.
gcloud compute url-maps create my-url-map --default-service [1] --host-rules "hosts=[2],pathMatcher=path-matcher-1"
The default service should be a backend service name like 'my-backend-service'. The host rule should specify the hostname, here 'example.com'.
Fill all three blanks to add a path matcher with path rules to an existing URL map.
gcloud compute url-maps add-path-matcher my-url-map --path-matcher-name [1] --default-service [2] --path-rules "/api/*=[3]"
The path matcher name should be descriptive like 'api-matcher'. The default service and the backend for the path rule should be the backend service handling API traffic, here 'api-backend'.