Google Cloud Associate Cloud Engineer — Question 131
You have created a code snippet that should be triggered whenever a new file is uploaded to a Cloud Storage bucket. You want to deploy this code snippet. What should you do?
Answer options
- A. Use App Engine and configure Cloud Scheduler to trigger the application using Pub/Sub.
- B. Use Cloud Functions and configure the bucket as a trigger resource.
- C. Use Google Kubernetes Engine and configure a CronJob to trigger the application using Pub/Sub.
- D. Use Dataflow as a batch job, and configure the bucket as a data source.
Correct answer: B
Explanation
The correct answer is B because Cloud Functions is specifically designed to run code in response to events, such as file uploads in Cloud Storage. Options A and C involve more complex setups that are not necessary for this use case, while option D is focused on batch processing, which does not suit the requirement for immediate triggering on file uploads.