Google Associate Cloud EngineerDeploying and implementing a cloud solutionMedium

A developer is creating a serverless application that needs to perform image resizing whenever a new image is uploaded to a Cloud Storage bucket. The resizing logic is written in Python. Which Google Cloud service should the developer use to implement this functionality with minimal infrastructure management?

  1. ACloud Run service receiving Pub/Sub notifications
  2. BApp Engine Standard application with a cron job
  3. CCloud Functions triggered by Cloud Storage events
  4. DCompute Engine instance with a custom image processing script
Show answer & explanation

Correct answer: C. Cloud Functions triggered by Cloud Storage events

Cloud Functions are ideal for event-driven serverless workloads. By configuring a Cloud Function to trigger on Cloud Storage object finalization events, the image resizing logic can be executed automatically without managing any servers, directly addressing the requirement for minimal infrastructure management.

Why the other options are wrong

  • A. Cloud Run could work, but it would require an intermediary Pub/Sub topic and a service to listen to it, adding complexity compared to a direct Cloud Storage trigger with Cloud Functions.
  • B. App Engine with a cron job is for scheduled tasks, not immediate event-driven processing of new uploads.
  • D. Compute Engine requires managing VMs, which is not 'minimal infrastructure management' for an event-driven task.

Cloud Functions

A serverless execution environment for building and connecting cloud services. It executes your code in response to events.

  • Event-driven: triggered by events from Cloud Storage, Pub/Sub, HTTP, etc.
  • Serverless: no server management required.
  • Scales automatically based on demand.
  • Supports various programming languages (Python, Node.js, Go, Java, .NET, Ruby, PHP).

Memory trick: Cloud Functions: When an event happens, your code 'functions' automatically.

More Deploying and implementing a cloud solution questions