GOOGLE-PROFESSIONAL-CLOUD-DEVELOPER practice question 6 of 35

Your company has created an application that uploads a report to a Cloud Storage bucket. When the report is uploaded to the bucket, you want to publish a message to a Cloud Pub/Sub topic. You want to implement a solution that will take a small amount to effort to implement. What should you do?

Full set: 265 questions
Answer options
A: Configure the Cloud Storage bucket to trigger Cloud Pub/Sub notifications when objects are modified. Correct answer
B: Create an App Engine application to receive the file; when it is received, publish a message to the Cloud Pub/Sub topic.
C: Create a Cloud Function that is triggered by the Cloud Storage bucket. In the Cloud Function, publish a message to the Cloud Pub/Sub topic.
D: Create an application deployed in a Google Kubernetes Engine cluster to receive the file; when it is received, publish a message to the Cloud Pub/Sub topic.
Correct Answer:
A. Configure the Cloud Storage bucket to trigger Cloud Pub/Sub notifications when objects are modified.
Explanation

The most direct and efficient solution with the least implementation effort is to use the built-in Cloud Storage notification feature. This feature is designed specifically for this use case, allowing a Cloud Storage bucket to publish a message directly to a Pub/Sub topic when an event, such as object creation, occurs. This is achieved through a simple configuration command (e.g., using gsutil) and requires no custom code, deployment pipelines, or compute infrastructure management. This approach directly satisfies the requirement for a solution that takes a "small amount of effort to implement."

Why Incorrect

B. Creating an App Engine application is unnecessarily complex and costly for this task. It involves developing, deploying, and managing an entire application, which is significantly more effort than the required task.
C. While a Cloud Function is a valid serverless approach, it requires writing, testing, and deploying code. This is more effort than the native notification feature (Option A), which is a pure configuration-based solution for simple notifications.
D. Using Google Kubernetes Engine (GKE) is the most complex and high-effort solution. It introduces significant operational overhead for containerization and cluster management, which is excessive for a simple event-driven notification.

References

1. Google Cloud Documentation - Pub/Sub notifications for Cloud Storage: "This feature allows you to send information about object changes in your bucket to Pub/Sub... Configuring Cloud Storage notifications to a Pub/Sub topic is the recommended way to track changes to objects in your Cloud Storage buckets." This source confirms that the direct notification feature is the primary and recommended method.

2. Google Cloud Serverless Cookbook - Notifying other services of Cloud Storage changes: "For simple notifications where you just need to announce that a file has been created or updated, use the built-in Cloud Storage notification feature that sends messages to a Pub/Sub topic." This explicitly recommends the direct notification feature (Option A) for simple use cases as described in the question.

3. Google Cloud Documentation - Cloud Storage Triggers for Cloud Functions: "Common use cases for Cloud Storage triggers include... performing data validation, transformation, and filtering on uploaded files..." This source indicates that Cloud Functions (Option C) are better suited for scenarios requiring data processing or transformation, which is not a stated requirement in the question.

Scroll to Top