Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
PMC: Routes and routing
📖 Scenario: You are setting up a simple web application on Google Cloud Platform (GCP). To make sure users reach the right parts of your app, you need to create routes that direct traffic properly.Think of routes like street signs in a city. Each sign points visitors to the correct destination. In this project, you will create routing rules for your app using GCP's Cloud Run service and URL maps.
🎯 Goal: Build a routing configuration on GCP that directs traffic to two different Cloud Run services based on the URL path.You will create a URL map with two routes: one for /app1/* and another for /app2/*. Each route will send traffic to its respective Cloud Run service.
📋 What You'll Learn
Create a URL map resource with routing rules
Define two backend services representing Cloud Run apps
Set routing rules to direct /app1/* to backend service 1
Set routing rules to direct /app2/* to backend service 2
💡 Why This Matters
🌍 Real World
Routing is essential in cloud applications to direct user requests to the correct services. This project simulates setting up routing rules for a multi-service web app on GCP.
💼 Career
Cloud engineers and DevOps professionals often configure routing and load balancing to ensure applications are reachable and scalable.
Progress0 / 4 steps
1
Create backend services for Cloud Run apps
Create two backend services named backend-app1 and backend-app2 representing your Cloud Run applications. Use the exact names and set the protocol to HTTP.
GCP
Hint
Use google_compute_backend_service resource with name and protocol set to HTTP.
2
Create a URL map resource
Create a URL map resource named app-url-map that will hold routing rules for your backend services.
GCP
Hint
Use google_compute_url_map resource with the name app-url-map.
3
Add routing rules to the URL map
Add routing rules to app-url-map so that requests to /app1/* go to backend-app1 and requests to /app2/* go to backend-app2. Use path_matcher blocks with path_rules for each route.
GCP
Hint
Use path_matcher blocks with path_rule inside the URL map to route paths to backend services.
4
Set default service for unmatched routes
Set the default_service attribute in app-url-map to point to backend-app1 so that any requests not matching /app1/* or /app2/* go to backend-app1.
GCP
Hint
Set the default_service attribute at the top level of the URL map resource.
Practice
(1/5)
1. What is the main purpose of a route in Google Cloud Platform networking?
easy
A. To create virtual machines
B. To store data in the cloud
C. To direct network traffic from one place to another
D. To monitor network usage
Solution
Step 1: Understand what routes do in networking
Routes tell network traffic where to go, like a map for data packets.
Step 2: Identify the correct purpose in GCP context
In GCP, routes guide traffic between subnets, VMs, and external networks.
Final Answer:
To direct network traffic from one place to another -> Option C
Quick Check:
Routes guide traffic = C [OK]
Hint: Routes always guide traffic flow in networks [OK]
Common Mistakes:
Confusing routes with storage or compute services
Thinking routes monitor traffic instead of directing it
Mixing routes with firewall rules
2. Which of the following is the correct way to specify a next hop in a GCP route configuration?
easy
A. nextHopAddress: "192.168.1.1"
B. nextHop: "192.168.1.1"
C. nextHopGateway: "192.168.1.1"
D. nextHopIp: "192.168.1.1"
Solution
Step 1: Recall GCP route next hop syntax
GCP routes use specific fields like nextHopIp to define the next hop IP address.
Step 2: Match the correct field name
Among options, only nextHopIp is valid for specifying an IP address as next hop.
Final Answer:
nextHopIp: "192.168.1.1" -> Option D
Quick Check:
Correct field for IP next hop = nextHopIp [OK]
Hint: Use nextHopIp to specify IP address next hop [OK]
Common Mistakes:
Using incorrect field names like nextHop or nextHopAddress
Confusing next hop IP with gateway name
Omitting quotes around IP address
3. Given the following route configuration snippet in GCP, what destination IP range will this route apply to?