0
0
GCPcloud~10 mins

Performance optimization 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 enable autoscaling for a Google Cloud Compute Engine instance group.

GCP
gcloud compute instance-groups managed set-autoscaling [1] --max-num-replicas=10 --min-num-replicas=1 --target-cpu-utilization=0.6 --zone=my-zone
Drag options to blanks, or click blank then click option'
Amy-instance-group
Bmy-instance-template
Cmy-zone
Dmy-project
Attempts:
3 left
💡 Hint
Common Mistakes
Using the instance template name instead of the instance group name.
Confusing zone or project with the instance group.
2fill in blank
medium

Complete the code to create a Cloud CDN-enabled backend service.

GCP
gcloud compute backend-services create [1] --enable-cdn --protocol=HTTP --port-name=http --global
Drag options to blanks, or click blank then click option'
Amy-instance-group
Bmy-load-balancer
Cmy-backend-service
Dmy-cdn-config
Attempts:
3 left
💡 Hint
Common Mistakes
Using instance group or load balancer names instead of backend service name.
Trying to use a CDN config name which is not a resource.
3fill in blank
hard

Fix the error in the Terraform snippet to enable autoscaling on a GCP instance group.

GCP
resource "google_compute_autoscaler" "autoscaler" {
  name   = "autoscaler-example"
  target = google_compute_instance_group_manager.example.[1]

  autoscaling_policy {
    max_replicas    = 5
    min_replicas    = 1
    cpu_utilization {
      target = 0.6
    }
  }
}
Drag options to blanks, or click blank then click option'
Aself_link
Binstance_template
Cname
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using instance_template or name instead of self_link.
Using id which is not the correct reference.
4fill in blank
hard

Fill both blanks to configure a Cloud Storage bucket for website hosting with caching.

GCP
resource "google_storage_bucket" "website_bucket" {
  name          = "my-website-bucket"
  location      = "US"
  website {
    main_page_suffix = [1]
    not_found_page   = [2]
  }
  uniform_bucket_level_access = true
}
Drag options to blanks, or click blank then click option'
A"index.html"
B"404.html"
C"default.html"
D"error.html"
Attempts:
3 left
💡 Hint
Common Mistakes
Using error.html instead of 404.html for not found page.
Using default.html which is not standard.
5fill in blank
hard

Fill all three blanks to create a Cloud Run service with autoscaling based on concurrency and CPU utilization.

GCP
resource "google_cloud_run_service" "service" {
  name     = "my-service"
  location = "us-central1"

  template {
    spec {
      containers {
        image = "gcr.io/my-project/my-image"
        resources {
          limits = {
            cpu = [1]
          }
        }
      }
      container_concurrency = [2]
    }
  }

  traffic {
    percent         = 100
    latest_revision = true
  }

  autogenerate_revision_name = true

  metadata {
    annotations = {
      "autoscaling.knative.dev/target" = "[3]"
    }
  }
}
Drag options to blanks, or click blank then click option'
A"1"
B80
C"80"
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using numbers instead of strings for CPU limits or annotations.
Confusing concurrency with autoscaling target values.