Courseiva
Deploying and Implementing a Cloud SolutionmediumMultiple ChoiceObjective-mapped

Google ACE Deploying and Implementing a Cloud Solution Practice Question

An engineer wants to deploy a Python function that processes messages from a Pub/Sub topic. The function should be triggered whenever a message is published to the topic. Which command should the engineer use to deploy the function?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

gcloud functions deploy my-function --runtime python39 --trigger-topic my-topic --entry-point main --region=us-central1

To deploy a Cloud Function triggered by a Pub/Sub topic, use gcloud functions deploy with --trigger-topic. Option C is correct. Option A uses --trigger-http for HTTP triggers. Option B uses --trigger-topic but misspells --entry-point as --entry-points. Option D uses --trigger-bucket for Cloud Storage events.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • gcloud functions deploy my-function --runtime python39 --trigger-http --entry-point main --region=us-central1

    Why it's wrong here

    The --trigger-http flag configures an HTTP-triggered function, exposing an HTTPS endpoint that invokes the function when a request is made. It does not create a Pub/Sub subscription, so the function would never fire from messages published to a topic. To meet the requirement, you must use --trigger-topic, which registers a background function tied to Pub/Sub.

  • gcloud functions deploy my-function --runtime python39 --trigger-topic my-topic --entry-points main --region=us-central1

    Why it's wrong here

    The flag --entry-points is misspelled; gcloud functions deploy only accepts the singular --entry-point. This command fails with an invalid flag error before touching any deployment. Even though --trigger-topic my-topic is correctly specified, the typo prevents the function from being deployed.

  • gcloud functions deploy my-function --runtime python39 --trigger-topic my-topic --entry-point main --region=us-central1

    Why this is correct

    This is the correct command because --trigger-topic my-topic binds the function to Pub/Sub, causing it to be invoked every time a message is published to that topic. The --entry-point main identifies the Python callable in the code, while --runtime python39 specifies the runtime. It correctly deploys a background Cloud Function without exposing an HTTP endpoint.

  • gcloud functions deploy my-function --runtime python39 --trigger-bucket my-bucket --entry-point main --region=us-central1

    Why it's wrong here

    The --trigger-bucket flag configures the function to be triggered by Cloud Storage events such as object finalization or deletion in the specified bucket. This is unrelated to Pub/Sub topics, so the function wouldn't process messages as required. Use --trigger-topic instead to listen to a Pub/Sub topic.

About these practice questions

This ACE question is part of Courseiva's 769-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.