Google Cloud · Serverless
Cloud Run functions
Deploy single functions in Python, Node.js, Go, Java and more; Google builds the container and runs it on Cloud Run.
On the Google Cloud Associate Cloud Engineer exam listServerlessEvent routing
What it is and what problem it solves
Cloud Run functions (formerly Cloud Functions) let you deploy a function's source code; Google builds it into a container and runs it on Cloud Run's infrastructure. Functions respond to HTTP requests or to events delivered through Eventarc, such as a Pub/Sub message or a new object in a Cloud Storage bucket. You get Cloud Run's scaling, concurrency and revisions without writing a Dockerfile.
When to use it
- Small event handlers: process an uploaded file, react to a Pub/Sub message, run on a schedule.
- Webhooks and lightweight HTTP endpoints.
- Glue code between Google Cloud services.
When to avoid it
- Larger applications with many routes or custom runtimes: deploy a Cloud Run service from a container.
- Long-running work beyond the function timeout: Cloud Run jobs or GKE.
Cost model
What you pay for
- Billed like Cloud Run: CPU and memory while handling requests or events, plus invocations.
- Builds (Cloud Build) and image storage (Artifact Registry).
Where it is cost-efficient
Bursty, short event handlers that are idle most of the time.
Where costs grow
Functions that wait on slow dependencies, or retry storms from failing event handlers.
Cost controls and common surprises
Set timeouts and max instances, make handlers idempotent, and route repeated failures to a dead-letter topic.
Prices differ by Region and change over time; see the pricing page linked under Sources.
Security
Controls the service provides
Attached service account per function; IAM invoker control; ingress settings for internal-only functions.
What you configure
One service account per function with minimal roles, secrets from Secret Manager, validate event payloads.
Exam cues and common confusions
- Run code when a file lands in a bucket or a Pub/Sub message arrives: Cloud Run functions with an Eventarc trigger.
- Events can be delivered more than once: make handlers idempotent.
- Cloud Functions is now Cloud Run functions.
Related
Services, comparisons and patterns
- Cloud Run · Service
- Eventarc · Service
- Pub/Sub · Service
- Cloud Storage · Service
- Event-driven order processing · Solution pattern
- Event-driven architecture · Architecture style
- Cloud Run vs GKE vs Compute Engine · Comparison
- 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.