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?
Click on the arrows to vote for the correct answer
A. B. C. D.C.
https://cloud.google.com/storage/docs/pubsub-notificationsThe requirement is to publish a message to a Cloud Pub/Sub topic when a report is uploaded to a Cloud Storage bucket. The solution should take a small amount of effort to implement.
Option A: Configure the Cloud Storage bucket to trigger Cloud Pub/Sub notifications when objects are modified.
This option is a good fit for the requirement because it allows triggering a Cloud Pub/Sub notification whenever an object is uploaded to a Cloud Storage bucket. It is a simple and straightforward approach that requires minimal effort to implement.
To use this option, you need to create a Cloud Pub/Sub topic and subscription. Then, you can configure the Cloud Storage bucket to send notifications to the Cloud Pub/Sub topic when a new object is created or updated. You can also configure the notification payload to include the object name, bucket name, and other metadata.
Option B: Create an App Engine application to receive the file; when it is received, publish a message to the Cloud Pub/Sub topic.
This option involves creating an App Engine application that receives the uploaded file and publishes a message to the Cloud Pub/Sub topic. Although it is a feasible solution, it requires more effort to implement than Option A.
To use this option, you need to create an App Engine application, configure it to receive the uploaded file, and then publish a message to the Cloud Pub/Sub topic. This approach requires more code to be written and deployed, which increases the complexity of the solution.
Option 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 option is similar to Option A, but instead of triggering a notification directly from the Cloud Storage bucket, it involves triggering a Cloud Function that publishes a message to the Cloud Pub/Sub topic. This approach requires a bit more effort to implement than Option A, but it offers more flexibility.
To use this option, you need to create a Cloud Function that is triggered by the Cloud Storage bucket. When the Cloud Function is triggered, it should publish a message to the Cloud Pub/Sub topic. This approach allows you to perform additional processing on the uploaded file before publishing the message, such as transforming the data or performing some validation.
Option 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 option is the most complex and requires the most effort to implement. It involves creating an application deployed in a Google Kubernetes Engine cluster that receives the uploaded file and publishes a message to the Cloud Pub/Sub topic. This option may be suitable for complex use cases that require high scalability and flexibility.
To use this option, you need to create a Kubernetes deployment that runs your application and configure it to receive the uploaded file and publish a message to the Cloud Pub/Sub topic. This approach requires more resources and expertise than the other options.
Conclusion:
Option A is the best fit for the requirement since it is the easiest and most straightforward to implement. It allows you to trigger a Cloud Pub/Sub notification whenever an object is uploaded to a Cloud Storage bucket, with minimal effort. Option C can also be considered if additional processing is required before publishing the message to the Cloud Pub/Sub topic. Option B and Option D are feasible but require more effort to implement.