Professional Cloud Developer Exam QuestionsBrowse all questions from this exam

Professional Cloud Developer Exam - Question 74


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?

Show Answer
Correct Answer: AC

To achieve the desired functionality with minimal effort, the most appropriate solution is to configure the Cloud Storage bucket to trigger Cloud Pub/Sub notifications when objects are modified (such as when the report is uploaded). This approach leverages built-in integration between Cloud Storage and Cloud Pub/Sub, eliminating the need to write and deploy additional code or infrastructure. By configuring Cloud Storage settings directly, the system can automatically send notifications to a Pub/Sub topic upon object changes, ensuring efficient and reliable message delivery.

Discussion

12 comments
Sign in to comment
donchickOption: A
Dec 21, 2020

Since one of reqs is "You want to implement a solution that will take a small amount to effort to implement" I'd choose A because no code has to be written. However option C works great as well and is recommended by https://cloud.google.com/storage/docs/pubsub-notifications#other_notification_options.

closer89
May 8, 2023

you link says that you use cloud functions only when you dont want to publish message to pubsub

StelSenOption: A
Feb 20, 2021

Option-A required least amount of effort to implement. https://cloud.google.com/storage/docs/reporting-changes#enabling

syu31svc
Jul 11, 2021

Agree; just a one line code and you're done

omermahgoubOption: C
Jan 8, 2023

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. This would be the most straightforward and easiest solution to implement, as it only requires creating a Cloud Function and setting it up to be triggered by the Cloud Storage bucket. This solution would not require deploying any additional resources, such as App Engine or a Kubernetes cluster, and would not require any significant code changes to the application uploading the report.

zevexWM
Jan 10, 2023

A does exactly the same just without Cloud Functions. Notifications triggered by a Cloud Storage event, work as a trigger for PubSub. No need for Cloud Functions.

zevexWM
Jan 16, 2023

Changing to option C. Option A state "when objects are modified" which is not the request here.

closer89
May 8, 2023

documentation says that you use cloud functions only when you dont want to publish message to pubsub. but you need to publish message to pubsub - therefore answer is A https://cloud.google.com/storage/docs/pubsub-notifications#other_notification_options https://cloud.google.com/storage/docs/pubsub-notifications#overview

ParagSanyashivOption: A
Jan 8, 2022

Answer A takes least effort to implement the solution

tomato123Option: A
Aug 20, 2022

I think A is correct

mariorossiOption: C
Jan 24, 2022

A not is correct because trigger must to be only in insert and not modify. only C is possible

brewpikeOption: A
May 20, 2022

A : https://cloud.google.com/storage/docs/pubsub-notifications

brewpikeOption: C
May 20, 2022

Also, aren't cloud storage objects immutable you can't modify but version them.

cloud_enth0325Option: A
Jun 1, 2022

A -- Least steps for the overall requirement. Option C, tho suggested, won't need to trigger pub/sub unless it requires heavyweight or many subsequent steps. (https://cloud.google.com/storage/docs/pubsub-notifications#:~:text=don%27t%20want%20to%20manage%20a%20Pub/Sub%20topic)

RajanOption: A
Sep 20, 2023

A is correct.

santoshchauhanOption: A
Mar 8, 2024

A. Configure the Cloud Storage bucket to trigger Cloud Pub/Sub notifications when objects are modified. This solution is straightforward and requires minimal effort to implement. Google Cloud Storage offers native support for publishing messages to Cloud Pub/Sub topics in response to changes in your bucket, like uploading a new file. By configuring Cloud Storage to automatically send a message to a Pub/Sub topic when a new report is uploaded, you can easily set up a real-time notification system without the need to write and maintain additional code.

thewalkerOption: A
Jul 17, 2024

The best answer is A. Configure the Cloud Storage bucket to trigger Cloud Pub/Sub notifications when objects are modified. Here's why: Simplicity and Ease of Implementation: This approach is the most straightforward and requires minimal effort. Cloud Storage offers built-in integration with Cloud Pub/Sub, allowing you to configure notifications directly within the bucket settings. No Additional Code: You don't need to write any custom code or deploy additional applications. Cloud Storage handles the notification process automatically. Scalability and Reliability: Cloud Pub/Sub is a highly scalable and reliable messaging service, ensuring that your notifications are delivered efficiently and reliably.

thewalker
Jul 17, 2024

Let's look at why the other options are less ideal: B. Create an App Engine application to receive the file; when it is received, publish a message to the Cloud Pub/Sub topic. This approach requires you to create and deploy an App Engine application, which adds complexity and overhead. 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. While Cloud Functions are a good option for event-driven tasks, this approach still requires you to write and deploy code, making it more complex than using built-in Cloud Storage notifications. 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. This is the most complex and resource-intensive approach. It requires you to create and manage a Kubernetes cluster, deploy an application, and handle the notification process within your application code.