Google Cloud Platform Guide 2026 — Cloud Run, BigQuery, Firebase, and GKE
Advertisement
Introduction
Why This Matters
GCP is underrated by many developers who default to AWS. In 2026, Google Cloud leads in several categories: Cloud Run (simplest serverless containers), BigQuery (best managed analytics), Vertex AI (Google's foundational models), and GKE (most polished managed Kubernetes). If your team already uses Google Workspace or needs the best SQL analytics, GCP deserves serious consideration.
GCP vs AWS Quick Reference
| Category | AWS | GCP |
|---|---|---|
| Serverless containers | ECS Fargate | Cloud Run |
| Managed Kubernetes | EKS | GKE |
| Serverless functions | Lambda | Cloud Functions |
| Object storage | S3 | Cloud Storage |
| Managed databases | RDS | Cloud SQL |
| Analytics data warehouse | Redshift | BigQuery |
| CDN | CloudFront | Cloud CDN |
| ML platform | SageMaker | Vertex AI |
| NoSQL | DynamoDB | Firestore |
Cloud Run: Serverless Containers
Cloud Run deploys any container without Kubernetes knowledge — scales to zero, scales to thousands:
# Deploy from image
gcloud run deploy my-app \
--image gcr.io/my-project/my-app:latest \
--platform managed \
--region us-central1 \
--allow-unauthenticated \
--memory 512Mi \
--cpu 1 \
--min-instances 0 \
--max-instances 100 \
--concurrency 80
# Deploy directly from source (builds with Buildpacks)
gcloud run deploy my-app \
--source . \
--region us-central1
# Set secrets from Secret Manager
gcloud run services update my-app \
--set-secrets DATABASE_URL=my-db-url:latest \
--region us-central1# .github/workflows/cloud-run.yml
name: Deploy to Cloud Run
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Build and push image
run: |
gcloud builds submit \
--tag gcr.io/my-project/my-app:${{ github.sha }} .
- uses: google-github-actions/deploy-cloudrun@v2
with:
service: my-app
image: gcr.io/my-project/my-app:${{ github.sha }}
region: us-central1Firebase: Real-Time Applications
// Firebase Admin SDK for server-side operations
import { initializeApp, cert } from 'firebase-admin/app'
import { getFirestore, FieldValue, Timestamp } from 'firebase-admin/firestore'
import { getAuth } from 'firebase-admin/auth'
const app = initializeApp({
credential: cert(JSON.parse(process.env.FIREBASE_SERVICE_ACCOUNT!)),
})
const db = getFirestore(app)
const auth = getAuth(app)
// CRUD operations
async function createPost(data: { title: string; body: string; userId: string }) {
const ref = await db.collection('posts').add({
...data,
createdAt: FieldValue.serverTimestamp(),
views: 0,
published: false,
})
return ref.id
}
async function getPostsByTag(tag: string) {
const snapshot = await db.collection('posts')
.where('tags', 'array-contains', tag)
.where('published', '==', true)
.orderBy('createdAt', 'desc')
.limit(20)
.get()
return snapshot.docs.map(doc => ({ id: doc.id, ...doc.data() }))
}
// Verify Firebase Auth token in API endpoints
async function verifyToken(token: string) {
const decoded = await auth.verifyIdToken(token)
return { uid: decoded.uid, email: decoded.email }
}// Firebase Client SDK — real-time listener
import { initializeApp } from 'firebase/app'
import { getFirestore, onSnapshot, collection, query, where, orderBy } from 'firebase/firestore'
import { useState, useEffect } from 'react'
const db = getFirestore(initializeApp({
apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
}))
function useRealtimePosts(tag: string) {
const [posts, setPosts] = useState<any[]>([])
useEffect(() => {
const q = query(
collection(db, 'posts'),
where('tags', 'array-contains', tag),
where('published', '==', true),
orderBy('createdAt', 'desc')
)
const unsubscribe = onSnapshot(q, (snapshot) => {
setPosts(snapshot.docs.map(doc => ({ id: doc.id, ...doc.data() })))
})
return unsubscribe
}, [tag])
return posts
}BigQuery: Analytics at Petabyte Scale
BigQuery processes petabytes in seconds and charges per query (1TB free/month):
-- Partition + cluster for cost efficiency
CREATE OR REPLACE TABLE myapp.events
PARTITION BY DATE(event_time)
CLUSTER BY event_type, user_id
AS SELECT
user_id,
event_type,
JSON_EXTRACT_SCALAR(metadata, '$.page') AS page,
TIMESTAMP_MILLIS(timestamp) AS event_time
FROM raw_events;
-- Daily Active Users over last 30 days
SELECT
DATE(event_time) AS date,
COUNT(DISTINCT user_id) AS dau,
COUNT(*) AS total_events
FROM myapp.events
WHERE event_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
GROUP BY date
ORDER BY date DESC;
-- Conversion funnel
WITH funnel AS (
SELECT user_id,
COUNTIF(event_type = 'signup') > 0 AS signed_up,
COUNTIF(event_type = 'first_post') > 0 AS created_post,
COUNTIF(event_type = 'subscription') > 0 AS subscribed
FROM myapp.events
GROUP BY user_id
)
SELECT
COUNT(*) AS total_users,
COUNTIF(signed_up) AS step1_signup,
COUNTIF(created_post) AS step2_post,
COUNTIF(subscribed) AS step3_subscribe,
ROUND(100 * COUNTIF(created_post) / COUNT(*), 1) AS signup_to_post_pct,
ROUND(100 * COUNTIF(subscribed) / COUNT(*), 1) AS signup_to_paid_pct
FROM funnel;GKE: Managed Kubernetes
# Create autopilot cluster (Google manages node scaling)
gcloud container clusters create-auto my-cluster \
--region us-central1
# Standard cluster with node auto-scaling
gcloud container clusters create my-cluster \
--num-nodes=3 \
--zone=us-central1-a \
--machine-type=e2-standard-2 \
--enable-autoscaling \
--min-nodes=1 \
--max-nodes=10 \
--enable-autorepair \
--enable-autoupgrade \
--workload-pool=my-project.svc.id.goog
# Get credentials and deploy
gcloud container clusters get-credentials my-cluster --zone=us-central1-a
kubectl apply -f k8s/Vertex AI: ML on GCP
import vertexai
from vertexai.generative_models import GenerativeModel, Part
vertexai.init(project="my-project", location="us-central1")
model = GenerativeModel("gemini-1.5-pro")
# Text generation
response = model.generate_content("Summarize this article: ...")
print(response.text)
# Multimodal — analyze image + text
image_part = Part.from_uri(
uri="gs://my-bucket/image.jpg",
mime_type="image/jpeg"
)
response = model.generate_content([image_part, "Describe this image"])
# Text embeddings for vector search
from vertexai.language_models import TextEmbeddingModel
embed_model = TextEmbeddingModel.from_pretrained("text-embedding-004")
embeddings = embed_model.get_embeddings(["my search query"])
vector = embeddings[0].values # 768-dimensional float arrayCommon Mistakes
- Skipping Workload Identity — do not use service account JSON keys in GKE; use Workload Identity to bind GCP IAM to Kubernetes ServiceAccounts
- BigQuery full-table scans — always partition by date and cluster by frequently filtered columns to avoid scanning entire tables
- Cloud Run without minimum instances — setting
min-instances=0causes cold starts; set it to 1 for latency-sensitive services - No IAM least-privilege — GCP IAM is granular; never use Project Owner on a service account; bind only the roles each service needs
- Firestore without indexes — compound queries require explicit index definitions; create them before deploying query code
Best Practices
- Use Cloud Run for stateless services — it handles scaling, SSL, and health checks with zero configuration
- Partition BigQuery tables by date column and cluster by high-cardinality filter columns to cut query costs by 80-90%
- Use Workload Identity in GKE to grant pods access to GCP APIs without managing service account keys
- Enable VPC Service Controls for sensitive data workloads to prevent data exfiltration even by authorized users
- Use Cloud Armor (GCP WAF) in front of Cloud Run and GKE for DDoS protection and geo-blocking
Key Takeaways
- Cloud Run is the simplest serverless container platform — deploy any Docker image, it handles scaling from zero to 1000 instances automatically
- BigQuery is billed per bytes scanned; partitioned and clustered tables reduce costs by 60-90% for time-series data
- Firebase Firestore real-time listeners push document changes to all connected clients within milliseconds — no polling needed
- GKE Autopilot manages node provisioning automatically so you only pay for actual pod resource requests, not wasted node capacity
- Vertex AI gives direct API access to Gemini models plus embeddings, fine-tuning, and vector search in one managed platform
- Workload Identity binds Kubernetes ServiceAccounts to GCP IAM roles — eliminates service account JSON key files entirely
- Cloud Build integrates with Cloud Run for source-to-deployed workflows without writing Dockerfiles
- GCP free tier includes BigQuery 1TB queries/month, Cloud Run 2M requests/month, and Firestore 50K reads/day
Advertisement