Google Professional Cloud Developer exam dumps

Google Professional Cloud Developer practice question 344 of 481

Professional Cloud Developer. Professional level, Google Cloud. Free question with the correct answer and a full explanation.

Google Professional Cloud Developer Question 344

Single answerGoogle Cloud Platform

You are building a serverless application using Google Cloud Functions, and you need to trigger a function whenever a file is uploaded to a specific Cloud Storage bucket. How should you configure the trigger to achieve this?

  1. A

    Set up an Eventarc trigger with a Cloud Storage event type and specify the bucket name.

  2. B

    Configure a Pub/Sub topic and write a custom script to monitor the bucket for changes.

  3. C

    Use Cloud Scheduler to check the bucket periodically and invoke the function manually.

  4. D

    Create a Cloud Storage trigger directly on the Cloud Function and specify the bucket name and event type.

Show answer and explanation

Correct answer: D

Explanation

To trigger a Cloud Function when a file is uploaded to a specific Cloud Storage bucket, the most efficient and native solution is to use a Cloud Storage trigger directly in Google Cloud Functions. This eliminates the need for additional components like Eventarc or Pub/Sub and integrates seamlessly with the event-driven nature of the application.

  • A. Incorrect.

    While Eventarc can be used to handle various event triggers, the most straightforward and recommended approach for triggering a function from a Cloud Storage event is to use a Cloud Storage-specific trigger directly in Cloud Functions.

  • B. Incorrect.

    This approach is unnecessarily complex for the given requirement. Using Pub/Sub for this purpose would require additional setup and maintenance, which is not needed here.

  • C. Incorrect.

    Cloud Scheduler is not designed for event-driven architectures. It is used for time-based scheduling and would not provide real-time triggering for file uploads.

  • D. Correct.

    This is the correct approach because Google Cloud Functions natively supports Cloud Storage triggers. You can specify the bucket name and event type (e.g., 'google.storage.object.finalize') to invoke the function whenever a file is uploaded.

Timed practice exam

Take a Google Professional Cloud Developer practice test under exam conditions

60 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam