Google Cloud · Serverless
Cloud Run
Run containers without managing servers: request-driven services and run-to-completion jobs that scale automatically, down to zero.
On the Google Cloud Associate Cloud Engineer exam listServerlessLoad balancing
What it is and what problem it solves
Cloud Run runs any container image. Services listen for HTTP, gRPC or WebSocket requests and scale the number of instances with traffic, down to zero when idle; each instance handles up to its concurrency setting of requests at a time. Jobs run containers to completion for batch work, and worker pools handle pull-based background work. Each service gets an HTTPS URL, revisions with traffic splitting, and an attached service account.
When to use it
- Stateless web apps, APIs and webhooks with variable traffic.
- Event handlers triggered by Pub/Sub, Eventarc or Cloud Scheduler.
- Batch jobs and scheduled tasks (Cloud Run jobs).
- Teams that want containers without running Kubernetes.
When to avoid it
- Workloads needing node-level control, privileged containers or Kubernetes APIs: GKE.
- Requests that run longer than the maximum request timeout: use jobs or GKE.
- Software that can't run in a container or needs a specific OS setup: Compute Engine.
Scaling model and bottlenecks
Instances = requests in flight ÷ concurrency, within your minimum and maximum instances. Minimum instances avoid cold starts; maximum instances protect databases and other dependencies from connection storms.
Limits and quotas
| Item | Value | Context | Source |
|---|---|---|---|
| Maximum concurrent requests per instance | 1,000 Fixed limit |
The default is 80; set 1 for single-threaded or memory-heavy code. | Source checked |
| Maximum request timeout | 60 minutes Fixed limit |
The default is 5 minutes. | Source checked |
Quotas and limits change. Check the linked source before designing around a number.
Cost model
What you pay for
- Request-based billing: CPU and memory while requests are processed, plus a per-request fee.
- Instance-based billing: CPU and memory for the instance's whole lifetime (for background processing).
- Minimum instances bill while idle (at a lower rate); network egress and other services are extra.
Where it is cost-efficient
Spiky or low traffic that scales to zero; high concurrency per instance.
Where costs grow
Many minimum instances, concurrency set to 1 with high traffic, slow requests waiting on dependencies.
Cost controls and common surprises
Tune concurrency and CPU/memory, cap max instances, use committed use discounts for steady Cloud Run spend.
Prices differ by Region and change over time; see the pricing page linked under Sources.
Security
Controls the service provides
- Each service runs as an attached service account with short-lived credentials.
- IAM invoker permission controls who can call a service; ingress settings restrict to internal or load-balancer traffic.
- Sandboxed instances; images pulled from Artifact Registry.
What you configure
Use a dedicated service account per service, require authentication for internal services, read secrets from Secret Manager, and put public services behind a load balancer with Cloud Armor if they need WAF protection.
Shared responsibility
Google runs and patches the infrastructure and sandbox; you secure the container, its dependencies, identity and configuration.
Availability, backup and failure behavior
Services are regional and run across zones automatically. For regional failover, deploy to two regions behind a global external Application Load Balancer with serverless network endpoint groups.
Exam cues and common confusions
- Containers without servers, scale to zero: Cloud Run.
- Gradual rollout or rollback: traffic splitting between revisions.
- Cold starts: minimum instances; protect the database: maximum instances.
- Private service called by other services: require authentication and grant
roles/run.invoker.
Related
Courses and lessons
- Cloud Run Scaled; the Database Didn't · Google Cloud in Production · Members
Services, comparisons and patterns
- Cloud Run functions · Service
- Eventarc · Service
- Artifact Registry · Service
- Google Kubernetes Engine (GKE) · Service
- Cloud SQL · Service
- Cloud Load Balancing · Service
- Cloud Run vs GKE vs Compute Engine · Comparison
- Event-driven order processing · Solution pattern
- Pub/Sub vs Cloud Tasks vs Eventarc · Comparison
- Event-driven order processing · Solution pattern
Sources
Independent study material, not affiliated with or endorsed by Google. Google Cloud and service names are trademarks of Google LLC.