Question

Difficulty: EasyPlanning and Assessing Cloud Compute Solutions

A developer needs to run a small Python script that automatically resizes images whenever a user uploads a new image file to a Google Cloud Storage bucket. The solution must be serverless, event-driven, and execute code directly in response to cloud storage events without requiring the developer to build container images or manage cluster infrastructure. Which Google Cloud compute service should you recommend?

  1. Cloud FunctionsAnswer
  2. B
    Cloud Run
  3. C
    Compute Engine Spot VMs
  4. D
    Google Kubernetes Engine (GKE) Standard

Answer

Cloud Functions is the recommended compute solution because it provides a fully managed, serverless, event-driven execution environment for single-purpose code snippets triggered directly by Cloud Storage events.
Cloud Functions is designed specifically for event-driven, serverless execution of lightweight code triggered by Google Cloud services like Cloud Storage. It automatically scales and removes all server and container management overhead.

Step-by-Step Solution

1
Analyze the workload requirements
The requirement calls for running a Python script triggered by file upload events in Cloud Storage, without managing infrastructure or building container images.
Understanding the event trigger and operational management bounds allows choosing the most suitable serverless model.
2
Evaluate compute service options against constraints
Cloud Functions automatically listens to Cloud Storage bucket events and executes code directly. Cloud Run requires containerization, while Compute Engine and GKE require underlying infrastructure management.
Matching workload event-driven characteristics to native compute services identifies the optimal service.

Key Concept

Selecting serverless event-driven compute services for Cloud Storage event triggers
Rate this question