All GCP services

GCP · Serverless

Cloud Run

Containers, serverless, request-priced.

Official docs

Overview

Cloud Run runs stateless containers, auto-scaling to zero, billing per request and CPU time. Great for APIs and ephemeral QA environments.

When to use it

  • Per-PR ephemeral preview environments
  • API mocks/stubs for contract testing
  • Internal QA dashboards

Setup

  1. Build and push image: `gcloud builds submit --tag gcr.io/PROJECT/svc`.
  2. Deploy: `gcloud run deploy svc --image gcr.io/PROJECT/svc --region us-central1`.
  3. Set IAM (allow unauth or restrict to invokers).

How to use

Deploy revision
gcloud run deploy api --image gcr.io/PROJECT/api --region us-central1 --allow-unauthenticated
Traffic split (canary)
gcloud run services update-traffic api --to-revisions=api-002=10,api-001=90

QA use cases

  • Spin a Cloud Run service per pull request for end-to-end tests, tear down after merge.
  • Canary deploys gated by smoke tests against the 10% revision.