Google Cloud

Serverless — Cloud Functions & Cloud Run

Run event-driven functions (Cloud Functions) or any container serverlessly (Cloud Run).

GCP offers two complementary serverless compute options. Cloud Functions runs single-purpose functions triggered by events — HTTP, Cloud Storage changes, Pub/Sub messages, Firestore/Eventarc events — scaling automatically and billing per invocation and compute time. It is ideal for lightweight event handlers and glue logic.

Cloud Functions is a single-task gadget that springs to life for one job and switches off. Cloud Run is a pop-up shop in a standard shipping container: you can stock it with anything (any container), it opens more units when queues form, and it shuts entirely when the street is empty — paying rent only while open.

Key Concepts

1
Cloud Run is GCP's standout serverless container platform: it runs any container that listens on a port, scaling from zero to many instances based on concurrent requests, billing only for what you use. Because it runs containers, you are not constrained by a function runtime — any language, dependency, or binary works — making it a sweet spot between functions and full Kubernetes. Cloud Run supports request-based autoscaling with configurable concurrency (multiple requests per instance), revisions with traffic splitting for canary/blue-green deploys, and can be triggered by HTTP or events via Eventarc. Both eliminate server management; Cloud Run is increasingly the default for serverless web services and APIs on GCP.