Professional Cloud ArchitectAnalyze and optimize technical and business processesEasy
A startup is deploying a new web application on Google Cloud. To minimize initial infrastructure costs, they want to use a serverless architecture where possible. The application consists of a frontend served by Cloud Storage, a backend API, and a database. The backend API is expected to have highly variable traffic, with periods of no activity and sudden spikes. Which Google Cloud service should be chosen for the backend API to optimize cost and handle variable traffic efficiently?
- AGoogle Kubernetes Engine (GKE) Autopilot.
- BCloud Functions.
- CCompute Engine instances with a Managed Instance Group.
- DCloud Run.
Show answer & explanationAnswer & explanation
Correct answer: D. Cloud Run.
Cloud Run is a fully managed serverless platform that automatically scales from zero to many instances based on demand, and you only pay for the compute resources consumed during request processing. This makes it ideal for highly variable traffic patterns and cost optimization for a startup.
Why the other options are wrong
- A. GKE Autopilot manages the underlying infrastructure, but it's a Kubernetes service, which might be overkill for a simple API backend for a startup and still involves more cost and complexity than Cloud Run for this specific use case.
- B. Cloud Functions are suitable for event-driven, short-lived functions, but for a full-fledged API backend that might have longer-running requests or more complex container requirements, Cloud Run is generally more flexible and appropriate.
- C. Compute Engine with MIGs provides autoscaling but still incurs costs for minimum instances even during idle periods, and requires more management overhead than a fully serverless option.
Google Cloud Serverless Options
Managed services that abstract away infrastructure management, allowing developers to focus on code and pay only for resources consumed, ideal for variable workloads.
- Cloud Functions: Event-driven, short-lived functions.
- Cloud Run: Container-based, scales to zero, for web services and APIs.
- App Engine: Platform-as-a-Service, managed environment for web apps.
- Minimize operational overhead and optimize costs for variable traffic.
Memory trick: Run your containers serverlessly to scale from zero to hero.