Bird
Raised Fist0
GCPcloud~10 mins

Operational excellence in GCP - Interactive Code Practice

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

Complete the code to create a Cloud Storage bucket with versioning enabled.

GCP
resource "google_storage_bucket" "my_bucket" {
  name     = "my-versioned-bucket"
  location = "US"
  versioning {
    enabled = [1]
  }
}
Drag options to blanks, or click blank then click option'
Aenabled
Bfalse
Con
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using strings like 'enabled' or 'on' instead of boolean true/false
Setting versioning to false disables version control
2fill in blank
medium

Complete the code to define an alert policy that triggers when CPU usage exceeds 80%.

GCP
resource "google_monitoring_alert_policy" "high_cpu" {
  display_name = "High CPU Usage"
  combiner    = "OR"
  conditions {
    display_name = "CPU Usage Condition"
    condition_threshold {
      filter     = "metric.type=\"compute.googleapis.com/instance/cpu/utilization\""
      comparison = [1]
      threshold_value = 0.8
      duration   = "60s"
    }
  }
}
Drag options to blanks, or click blank then click option'
ACOMPARISON_GREATER_THAN
BCOMPARISON_LESS_THAN
CCOMPARISON_EQUAL
DCOMPARISON_NOT_EQUAL
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'COMPARISON_LESS_THAN' which triggers on low CPU usage
Using 'COMPARISON_EQUAL' which rarely matches exactly
3fill in blank
hard

Fix the error in the Terraform code to enable Stackdriver logging for a Google Cloud Function.

GCP
resource "google_cloudfunctions_function" "func" {
  name        = "my-function"
  runtime     = "python39"
  entry_point = "main"
  source_archive_bucket = "my-source-bucket"
  source_archive_object = "function-source.zip"
  trigger_http = true
  [1] = true
}
Drag options to blanks, or click blank then click option'
Aenable_logging
Blogging_enabled
Clabels
Dlog_enabled
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to set a non-existent boolean attribute to enable logging
Using incorrect attribute names that cause errors
4fill in blank
hard

Fill both blanks to create a Cloud Logging sink that exports logs to a Pub/Sub topic.

GCP
resource "google_logging_project_sink" "pubsub_sink" {
  name        = "pubsub-sink"
  destination = "pubsub.googleapis.com/projects/my-project/topics/[1]"
  filter      = "severity >= [2]"
}
Drag options to blanks, or click blank then click option'
Amy-topic
BERROR
CWARNING
Dlogs-topic
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong topic name or format in destination
Using a severity level that is too low or invalid
5fill in blank
hard

Fill all three blanks to define a Cloud Build trigger that starts on a push to the main branch.

GCP
resource "google_cloudbuild_trigger" "trigger" {
  name = "main-branch-trigger"
  github {
    owner = "my-org"
    name  = "my-repo"
    push {
      branch = "[1]"
    }
  }
  build {
    steps = [{
      name = "gcr.io/cloud-builders/gcloud"
      args = ["[2]", "[3]"]
    }]
  }
}
Drag options to blanks, or click blank then click option'
Amain
Bapp.yaml
Cdeploy
Dmaster
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'master' instead of 'main' for the branch name
Swapping the order of 'deploy' and 'app.yaml' in args

Practice

(1/5)
1. What is the main goal of operational excellence in cloud systems?
easy
A. Keep systems healthy and reliable
B. Write complex code
C. Reduce cloud costs only
D. Avoid using monitoring tools

Solution

  1. Step 1: Understand operational excellence purpose

    Operational excellence focuses on keeping cloud systems running well and reliable.
  2. Step 2: Compare options with this goal

    Only Keep systems healthy and reliable matches this goal; others focus on unrelated tasks.
  3. Final Answer:

    Keep systems healthy and reliable -> Option A
  4. Quick Check:

    Operational excellence = system health and reliability [OK]
Hint: Operational excellence means system health and reliability [OK]
Common Mistakes:
  • Confusing cost reduction with operational excellence
  • Thinking it means writing complex code
  • Ignoring monitoring and alerts
2. Which GCP service is used to monitor cloud resources and send alerts?
easy
A. Cloud Monitoring
B. Cloud Storage
C. Cloud Functions
D. Cloud SQL

Solution

  1. Step 1: Identify monitoring service in GCP

    Cloud Monitoring is designed to track resource health and send alerts.
  2. Step 2: Eliminate unrelated services

    Cloud Storage stores data, Cloud Functions run code, Cloud SQL manages databases.
  3. Final Answer:

    Cloud Monitoring -> Option A
  4. Quick Check:

    Monitoring and alerts = Cloud Monitoring [OK]
Hint: Monitoring and alerts in GCP use Cloud Monitoring [OK]
Common Mistakes:
  • Choosing Cloud Storage for monitoring
  • Confusing Cloud Functions with monitoring
  • Selecting Cloud SQL instead of monitoring
3. Given this snippet of a GCP alert policy configuration:
{
  "conditions": [{
    "displayName": "High CPU Usage",
    "conditionThreshold": {
      "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\"",
      "comparison": "COMPARISON_GT",
      "thresholdValue": 0.8,
      "duration": "300s"
    }
  }]
}

What does this alert do?
medium
A. Triggers if CPU usage is above 80% for 30 seconds
B. Triggers if CPU usage is below 80% for 5 minutes
C. Triggers if CPU usage is below 80% for 30 seconds
D. Triggers if CPU usage is above 80% for 5 minutes

Solution

  1. Step 1: Analyze threshold and duration

    ThresholdValue 0.8 means 80%, duration 300s means 5 minutes.
  2. Step 2: Understand comparison operator

    COMPARISON_GT means greater than, so alert triggers if CPU > 80% for 5 minutes.
  3. Final Answer:

    Triggers if CPU usage is above 80% for 5 minutes -> Option D
  4. Quick Check:

    CPU > 80% for 300s = alert triggers [OK]
Hint: COMPARISON_GT with 0.8 threshold means CPU > 80% [OK]
Common Mistakes:
  • Misreading COMPARISON_GT as less than
  • Confusing duration seconds with minutes
  • Ignoring threshold value meaning
4. You wrote this alert policy JSON but it never triggers:
{
  "conditions": [{
    "displayName": "Low Disk Space",
    "conditionThreshold": {
      "filter": "metric.type=\"compute.googleapis.com/instance/disk/bytes_used\"",
      "comparison": "COMPARISON_LT",
      "thresholdValue": 1000000000,
      "duration": "600s"
    }
  }]
}

What is the likely problem?
medium
A. Threshold value is too high
B. Using COMPARISON_LT instead of COMPARISON_GT
C. Filter metric type is incorrect
D. Duration is too short

Solution

  1. Step 1: Understand alert intent

    Low disk space alert should trigger when disk usage is high, so comparison should be greater than.
  2. Step 2: Check comparison operator

    COMPARISON_LT triggers when usage is less than threshold, opposite of intent.
  3. Final Answer:

    Using COMPARISON_LT instead of COMPARISON_GT -> Option B
  4. Quick Check:

    Low disk space needs COMPARISON_GT [OK]
Hint: Low disk space alert needs COMPARISON_GT, not LT [OK]
Common Mistakes:
  • Using less than instead of greater than
  • Misunderstanding metric meaning
  • Ignoring alert duration importance
5. Your team wants to improve operational excellence by automating recovery when a VM instance becomes unresponsive. Which GCP service combination best supports this goal?
hard
A. Cloud Storage + Cloud SQL for backups
B. Cloud Pub/Sub + BigQuery for data analysis
C. Cloud Monitoring + Cloud Functions to restart VM automatically
D. Cloud Run + App Engine for hosting apps

Solution

  1. Step 1: Identify automation for recovery

    Cloud Monitoring detects issues; Cloud Functions can run code to fix problems automatically.
  2. Step 2: Evaluate other options

    Cloud Storage and SQL are for data, Pub/Sub and BigQuery for messaging and analysis, Cloud Run and App Engine for app hosting, not recovery automation.
  3. Final Answer:

    Cloud Monitoring + Cloud Functions to restart VM automatically -> Option C
  4. Quick Check:

    Monitoring + automation = Cloud Monitoring + Cloud Functions [OK]
Hint: Use Monitoring to detect and Functions to automate fixes [OK]
Common Mistakes:
  • Choosing storage or database services for automation
  • Confusing data analysis tools with recovery tools
  • Ignoring automation in operational excellence
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard