0
0
GCPcloud~10 mins

High availability configuration 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 create a managed instance group with autohealing enabled.

GCP
resource "google_compute_instance_group_manager" "example" {
  name               = "example-group"
  base_instance_name  = "example-instance"
  zone               = "us-central1-a"
  version {
    instance_template = google_compute_instance_template.example.self_link
  }
  auto_healing_policies {
    health_check      = [1]
    initial_delay_sec = 300
  }
}
Drag options to blanks, or click blank then click option'
Agoogle_compute_subnetwork.example.self_link
Bgoogle_compute_health_check.example.self_link
Cgoogle_compute_network.example.self_link
Dgoogle_compute_firewall.example.self_link
Attempts:
3 left
💡 Hint
Common Mistakes
Using a firewall or network resource instead of a health check.
Omitting the health check reference.
2fill in blank
medium

Complete the code to configure a global HTTP load balancer backend service with session affinity.

GCP
resource "google_compute_backend_service" "default" {
  name                  = "backend-service"
  protocol              = "HTTP"
  load_balancing_scheme = "EXTERNAL"
  session_affinity      = [1]
  backends {
    group = google_compute_instance_group.example.self_link
  }
  health_checks = [google_compute_health_check.default.self_link]
}
Drag options to blanks, or click blank then click option'
ANONE
BCLIENT_IP
CGENERATED_COOKIE
DHTTP_COOKIE
Attempts:
3 left
💡 Hint
Common Mistakes
Using NONE disables session affinity.
CLIENT_IP may not work well with clients behind proxies.
3fill in blank
hard

Fix the error in the health check configuration to enable HTTPS health checks.

GCP
resource "google_compute_health_check" "https_check" {
  name               = "https-health-check"
  https_health_check {
    port             = [1]
    request_path     = "/healthz"
  }
  check_interval_sec = 10
  timeout_sec        = 5
  healthy_threshold  = 3
  unhealthy_threshold = 3
}
Drag options to blanks, or click blank then click option'
A443
B80
C8080
D22
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 80 for HTTPS health checks.
Using non-standard ports without proper configuration.
4fill in blank
hard

Fill both blanks to configure an instance group with autoscaling based on CPU utilization.

GCP
resource "google_compute_autoscaler" "cpu_autoscaler" {
  name   = "cpu-autoscaler"
  target = google_compute_instance_group_manager.example.self_link
  autoscaling_policy {
    max_replicas    = [1]
    cpu_utilization {
      target = [2]
    }
  }
}
Drag options to blanks, or click blank then click option'
A5
B0.6
C10
D0.8
Attempts:
3 left
💡 Hint
Common Mistakes
Setting max_replicas too high or too low.
Using CPU utilization target outside 0-1 range.
5fill in blank
hard

Fill all three blanks to configure a global forwarding rule for HTTPS traffic with a target proxy and SSL certificate.

GCP
resource "google_compute_global_forwarding_rule" "https_forwarding_rule" {
  name       = "https-forwarding-rule"
  target     = [1]
  port_range = [2]
  ip_protocol = [3]
}
Drag options to blanks, or click blank then click option'
Agoogle_compute_target_https_proxy.https_proxy.self_link
B"443"
C"TCP"
Dgoogle_compute_target_http_proxy.http_proxy.self_link
Attempts:
3 left
💡 Hint
Common Mistakes
Using HTTP proxy instead of HTTPS proxy as target.
Using wrong port or protocol for HTTPS traffic.