Medium1 markMultiple Choice
Domain 3.3: Deploying Cloud Run and Cloud FunctionsCloud FunctionsEvent-DrivenCloud StorageServerless

GCP ACE · Question 26 · Domain 3.3: Deploying Cloud Run and Cloud Functions

You are writing a Python script that needs to execute automatically every time a new image file is uploaded to a specific Cloud Storage bucket. The script will resize the image and save it to a different bucket. You want to deploy this with minimal infrastructure management.

How should you deploy this script?

Answer options:

A.

Deploy the script on a Compute Engine instance and use a cron job to poll the bucket every minute.

B.

Deploy the script to Cloud Run and configure Cloud Scheduler to trigger it.

C.

Deploy the script as a Cloud Function triggered by Cloud Storage events.

D.

Deploy the script to a GKE cluster and use a Kubernetes DaemonSet.

How to approach this question

Identify the requirement: execute code based on an event (file upload) with minimal management. This is the classic use case for Cloud Functions.

Full Answer

C.Deploy the script as a Cloud Function triggered by Cloud Storage events.✓ Correct
Deploy the script as a Cloud Function triggered by Cloud Storage events.
Cloud Functions is an event-driven serverless compute platform. It is the perfect solution for running lightweight, single-purpose scripts in response to events within Google Cloud. You can configure a Cloud Function to be triggered automatically by Cloud Storage events (specifically, the `google.storage.object.finalize` event), meaning your Python script will run instantly whenever a new image is uploaded, without you having to manage any servers or write polling logic.

Common mistakes

Choosing Compute Engine with polling, which is an anti-pattern in cloud architecture.

Practice the full GCP Associate Cloud Engineer Practice Exam 6

50 questions · hints · full answers · grading

More questions from this exam