Google Professional Cloud Developer Question 351
Select 3Google Cloud PlatformYou are building a serverless application on Google Cloud and need to configure an event-driven architecture to process changes to files uploaded to a Cloud Storage bucket. The architecture should trigger a Cloud Run service whenever a new file is created in the bucket. Which of the following steps should you take to configure this setup?
- A
Create a Cloud Storage bucket and enable Eventarc to capture events from the bucket.
- B
Deploy a Cloud Run service and set up an Eventarc trigger to listen for 'google.cloud.storage.object.v1.finalized' events.
- C
Configure Pub/Sub to directly trigger the Cloud Run service upon file uploads.
- D
Assign the 'roles/eventarc.eventReceiver' IAM role to the service account used by the Eventarc trigger.
- E
Enable the Cloud Storage API and Eventarc API in the Google Cloud project.
Show answer and explanation
Correct answers: B, D, E
Explanation
To configure a serverless event-driven architecture with Cloud Run and Eventarc, you need to deploy a Cloud Run service and create an Eventarc trigger to listen for specific event types, such as 'google.cloud.storage.object.v1.finalized'. Additionally, the necessary IAM roles and APIs (such as Eventarc and Cloud Storage) must be enabled to ensure proper permissions and functionality. Pub/Sub is not required in this setup as Eventarc directly integrates with Cloud Storage and Cloud Run.
- A. Incorrect.
Incorrect: While Eventarc does capture events from Cloud Storage, it does not require direct configuration on the bucket itself. Eventarc automatically integrates with Cloud Storage when appropriately set up.
- B. Correct.
Correct: Eventarc triggers can be configured to listen for specific event types, such as 'google.cloud.storage.object.v1.finalized', which corresponds to finalized files in a Cloud Storage bucket.
- C. Incorrect.
Incorrect: Pub/Sub cannot directly trigger a Cloud Run service in this scenario. Eventarc is used to route Cloud Storage events to Cloud Run.
- D. Correct.
Correct: The 'roles/eventarc.eventReceiver' IAM role is required for the Eventarc trigger to deliver events successfully to the Cloud Run service.
- E. Correct.
Correct: Both the Cloud Storage API and Eventarc API must be enabled in the project to allow Eventarc to process and route Cloud Storage events.