Getting Started with Cloud Run
Introduction: What is Google Cloud Run?
Welcome to Google Cloud Run, a fully managed serverless platform that runs containers directly on Google's infrastructure. With Cloud Run, you don't worry about servers, clusters, or orchestration. You simply provide a container image, and Cloud Run handles everything else—from provisioning and scaling to networking and security. It automatically scales your containers from zero to thousands based on traffic, and you pay only for the compute time you use, measured down to the nearest 100 milliseconds.
Cloud Run is built on Knative, an open-source Kubernetes-based platform, which means your containers are portable and can run anywhere Knative is supported. By abstracting away all infrastructure, Cloud Run lets you focus entirely on your application code. This lesson introduces Cloud Run's unique serverless model, its core concepts, and the prerequisites for deploying your first service.
What Makes Cloud Run Different
Cloud Run represents a fundamentally different approach to running containers. There are no clusters to create, no capacity to provision, and no infrastructure to manage. You work directly with services — each service is a running container that responds to requests.
When you deploy to Cloud Run, you're working with a serverless model. This means:
- Automatic scaling: Your service scales automatically from zero instances (when there's no traffic) to as many instances as needed to handle load. You don't configure scaling policies or thresholds — Cloud Run handles this intelligently based on incoming requests.
- Pay-per-use pricing: You're charged only for the CPU, memory, and networking resources your container uses while processing requests. When your service isn't handling traffic, you pay nothing for compute (though you may incur small storage costs for the container image).
- Fully managed infrastructure: Google handles all the underlying infrastructure, including networking, load balancing, SSL certificates, health checks, and logging. You never see or manage any servers.
- Request-based execution: Each container instance handles one or more concurrent requests. Cloud Run automatically routes traffic to healthy instances and creates new instances when needed.
Cloud Run services are stateless by design. This is a critical architectural principle: each request must be independent and self-contained. You cannot rely on data stored in a container's memory or local filesystem between requests, as any instance can be terminated at any time. For persistent data, you must use external services like Cloud Storage, Cloud SQL, or Firestore. This statelessness is what enables Cloud Run to scale rapidly and efficiently.
The platform provides two execution models: Cloud Run (fully managed), where Google handles everything, and Cloud Run for Anthos, which runs on your own Google Kubernetes Engine (GKE) clusters. The fully managed version offers the simplest experience, while Cloud Run for Anthos provides more control over the underlying network and compute environment, making it suitable for workloads with specific compliance or networking requirements. In this course, we'll focus on the fully managed version.
