Google Associate Cloud EngineerDeploying and implementing a cloud solutionMedium
A developer needs to create a serverless function that automatically resizes uploaded images to a Cloud Storage bucket. This function should trigger immediately after a new image file is uploaded. Which Google Cloud service should the developer use?
- ACloud Run
- BApp Engine Standard
- CCompute Engine
- DCloud Functions
Show answer & explanationAnswer & explanation
Correct answer: D. Cloud Functions
Cloud Functions is a serverless execution environment for event-driven code. It can be directly triggered by events from Google Cloud services like Cloud Storage, making it perfect for reacting to new file uploads to perform tasks such as image resizing.
Why the other options are wrong
- A. Cloud Run is for containerized microservices, typically invoked via HTTP requests, not directly by Cloud Storage events.
- B. App Engine Standard is a platform for building and deploying web applications, not primarily for small, event-driven functions.
- C. Compute Engine provides IaaS virtual machines, requiring manual server management and lacking native event-driven capabilities for this use case.
Google Cloud Functions
A serverless execution environment for building and connecting cloud services with event-driven code.
- Executes code in response to events (e.g., Cloud Storage uploads, Pub/Sub messages, HTTP requests).
- Fully managed, no server provisioning or management.
- Supports various programming languages (Node.js, Python, Go, Java, .NET, Ruby, PHP).
Memory trick: When 'events' trigger 'functions', the 'Cloud Functions' service is your instant reaction.