Serverless container platform for stateless applications
Core Idea: Cloud Run is Google Cloud's serverless compute platform that automatically scales stateless containers, charging only for the resources used during request processing with zero cost when idle.
Key Elements
-
Key Features
- Fully managed serverless environment
- Automatic scaling from zero to many instances
- Pay-per-use billing model (compute resources used)
- Native container support (Docker)
- HTTP/HTTPS request handling
- Background and scheduled tasks support
- Integrated with Google Cloud's security model
-
Technical Specifications
- Supports containers built for x86-64 architecture
- Maximum request timeout: 60 minutes
- Memory allocation options: 128MB to 32GB
- CPU allocation options: 1-8 vCPUs
- Concurrent requests per instance: configurable
- Instance startup time: typically seconds
- Container size limit: 10GB
- Environmental variable and secret integration
-
Use Cases
- API backends
- Web applications
- Microservices
- Event handlers and webhooks
- Scheduled jobs
- Data processing tasks
- Automation tools deployment
-
Implementation Steps
- Containerize application with Dockerfile
- Ensure container listens on PORT env variable (required)
- Deploy via gcloud CLI or Console
- Configure autoscaling parameters
- Set up service accounts and IAM permissions
- Connect to other Google Cloud services (optional)
-
Code Example
# Basic Cloud Run deployment command
gcloud run deploy SERVICE_NAME \
--image=CONTAINER_IMAGE \
--platform=managed \
--region=REGION \
--allow-unauthenticated \
--port=PORT_NUMBER \
--cpu=1 \
--memory=512Mi \
--min-instances=0 \
--max-instances=10 \
--set-env-vars="ENV_VAR1=value1,ENV_VAR2=value2"
Connections
- Related Concepts: Serverless Computing (parent category), Google Cloud Platform (platform provider), Docker (container technology used)
- Broader Context: Cloud Native Architecture (architectural paradigm)
- Applications: n8n on Cloud Run (workflow automation deployment), Serverless Cost Optimization (cost-effective deployment approach)
- Components: Cloud Run Service Account (identity mechanism), Cloud Run Revision (deployment versioning)
References
- Google Cloud Documentation: Cloud Run (https://cloud.google.com/run/docs)
- "Self-Hosting n8n on Google Cloud Run" guide
#serverless #google-cloud #containers #paas #cloud-native
Connections:
Sources:
- From: Lightweight guide for deploying n8n.io to Google Cloud Platform at low cost