Google Professional Cloud Developer Question 350
Single answerGoogle Cloud PlatformYou are developing a serverless application that needs to process events generated by a Cloud Storage bucket whenever a new file is created. You want to ensure the solution is scalable and cost-effective. Which of the following is the most appropriate way to configure the event receiver?
- A
Use Eventarc to create a trigger that listens to Cloud Storage events and routes them to a Cloud Run service.
- B
Configure a Pub/Sub topic to directly receive Cloud Storage events and subscribe a Cloud Run service to the topic.
- C
Set up a Cloud Functions trigger directly on the Cloud Storage bucket to process the events.
- D
Manually poll the Cloud Storage bucket at regular intervals to check for new files and process them.
Show answer and explanation
Correct answer: A
Explanation
Eventarc is the best choice for configuring an event receiver in this scenario. It allows you to create a trigger for Cloud Storage events and deliver them to a Cloud Run service in an efficient and scalable way. This approach leverages Google Cloud's event-driven architecture and avoids unnecessary complexity or overuse of resources.
- A. Correct.
Eventarc is the recommended solution for routing events from various Google Cloud sources, such as Cloud Storage, to a destination like Cloud Run. It is scalable, cost-effective, and integrates seamlessly with event-driven architectures.
- B. Incorrect.
While Pub/Sub can be used for event-driven architectures, Cloud Storage does not natively send events directly to Pub/Sub. Eventarc is required to bridge this gap.
- C. Incorrect.
While Cloud Functions can directly listen to Cloud Storage events, it is less flexible and scalable compared to Eventarc, especially if you plan to use Cloud Run for processing.
- D. Incorrect.
Polling a Cloud Storage bucket is not event-driven, is resource-intensive, and is not a scalable or cost-effective solution.