gcp-cloud-run

Specialized skill for building production-ready serverless applications on GCP. Covers Cloud Run services (containerized), Cloud Run Functions (event-driven), cold start optimization, and event-driven architecture with Pub/Sub.

Author

Install

Hot:2

Download and extract to your skills directory

Copy command and send to OpenClaw for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=sickn33-skills-gcp-cloud-run&locale=en&source=copy

GCP Cloud Run - Building Production-Grade Serverless Applications

Skills Overview


The GCP Cloud Run skills provide a complete guide to building production-grade serverless applications, covering Cloud Run container services, Cloud Run Functions event-driven functions, cold-start optimization, and best practices for Pub/Sub event-driven architectures.

Use Cases

1. Web Applications and API Deployment


Ideal for containerized web applications and RESTful APIs that need any runtime or libraries. Cloud Run lets you fully customize the container environment, so you can use familiar languages and frameworks while benefiting from automatic scaling and no infrastructure management.

2. Event-Driven Architectures


Suitable for scenarios involving Pub/Sub messages, Cloud Storage events, and HTTP webhooks. Cloud Run Functions offers lightweight event handling capabilities, making it well-suited for building message queue processing, file processing, and real-time response systems.

3. Stateless Services Requiring Rapid Scaling


Best for containerized workloads with high traffic variability that need to respond quickly. Cloud Run automatically scales from zero to handle high concurrency, charging based on requests, without the need to provision resources.

Core Features

1. Containerized Deployment of Cloud Run Services


Provides an end-to-end containerized web service deployment approach, including multi-stage Dockerfile optimization, health check endpoint configuration, graceful shutdown handling, and Cloud Build CI/CD integration. Supports configuration of custom memory, CPU, concurrency, and instance counts.

2. Event-Driven Cloud Run Functions


Covers complete implementations for HTTP functions, Pub/Sub message processing, and Cloud Storage triggers. Includes deployment commands and event handling patterns for second-generation functions (Gen2), suitable for building lightweight event processors.

3. Cold Start and Performance Optimization


Deep dives into practical techniques such as CPU Boost, minimum instance preheating, distroless image optimization, delayed initialization, and memory–CPU relationship tuning, helping reduce cold-start time to the minimum.

Common Questions

What’s the difference between Cloud Run and Cloud Functions? Which should I choose?


Cloud Run is best for containerized, complex services and applications that require any runtime, supporting multi-endpoint APIs and fully customizable container environments. Cloud Run Functions is better for simple event processors—such as processing Pub/Sub messages or Storage-trigger events from a single code file. If you need a full HTTP service framework, multiple endpoints, or complex dependencies, choose Cloud Run. If it’s a single event-handling logic, choose Cloud Run Functions.

How can I optimize Cloud Run cold start latency?


Start from multiple angles: enable CPU Boost (--cpu-boost) to provide extra CPU during startup; set minimum instances (--min-instances) to keep prewarmed instances; use distroless images to reduce container size; delay loading heavy dependencies until first use; and appropriately increase memory allocation (more memory = more CPU). Using these techniques together can typically reduce cold starts by 50% or more.

Can Cloud Run run long-running background tasks?


Not recommended. Cloud Run is designed for request-based workloads; when there are no requests, it throttles CPU down to near zero. Long-running background tasks will be extremely slow or may stop entirely. For background tasks, use dedicated GCP services such as Cloud Run Jobs, Cloud Tasks, or Cloud Scheduler. A Cloud Run best practice is the request–response model: handle the request and release resources immediately after completion.