0
0
GCPcloud~10 mins

HTTP(S) Load Balancer (Layer 7) in GCP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the protocol used by the HTTP(S) Load Balancer.

GCP
load_balancer = compute.loadBalancers().insert(project=project_id, body={"protocol": "[1]"})
Drag options to blanks, or click blank then click option'
AFTP
BTCP
CUDP
DHTTP
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing TCP or UDP which are Layer 4 protocols.
2fill in blank
medium

Complete the code to define the backend service for the HTTP(S) Load Balancer.

GCP
backend_service = compute.backendServices().insert(project=project_id, body={"name": "my-backend", "protocol": "[1]"})
Drag options to blanks, or click blank then click option'
ASSL
BTCP
CHTTP
DUDP
Attempts:
3 left
💡 Hint
Common Mistakes
Using TCP or UDP which are Layer 4 protocols.
3fill in blank
hard

Fix the error in the URL map configuration for routing HTTP requests.

GCP
url_map = compute.urlMaps().insert(project=project_id, body={"defaultService": "[1]"})
Drag options to blanks, or click blank then click option'
Abackend_service
BbackendService
Cbackend-service
Dbackendservice
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores or hyphens instead of camelCase.
4fill in blank
hard

Fill both blanks to create a health check configuration for the HTTP(S) Load Balancer.

GCP
health_check = compute.healthChecks().insert(project=project_id, body={"type": "HTTP", "port": [1], "requestPath": "[2]"})
Drag options to blanks, or click blank then click option'
A80
B/healthz
C443
D/status
Attempts:
3 left
💡 Hint
Common Mistakes
Using HTTPS port 443 for HTTP health checks.
Using incorrect request paths.
5fill in blank
hard

Fill all three blanks to define a URL map with path matcher and host rule for the HTTP(S) Load Balancer.

GCP
url_map = compute.urlMaps().insert(project=project_id, body={"hostRules": [{"hosts": ["[1]"], "pathMatcher": "[2]"}], "pathMatchers": [{"name": "[3]", "defaultService": backend_service_url}]})
Drag options to blanks, or click blank then click option'
Aexample.com
Bpath-matcher-1
CpathMatcher1
Ddefault-matcher
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching path matcher names.
Using invalid host names.