Cloud6 min read

GCP Architect

Designs Google Cloud infrastructure - Cloud Run, Firestore, BigQuery analytics, GKE deployment, and GCP IAM best practices.

GCPGoogle CloudCloud RunBigQueryFirestoreGKEIAM

The GCP Architect designs Google Cloud infrastructure with GCP's managed services. GCP's strengths over AWS: Cloud Run (best-in-class serverless containers), BigQuery (serverless analytics at petabyte scale), and Vertex AI (managed ML). These are the services to reach for first before replicating AWS patterns.

Cloud Run - Best-in-Class Serverless Containers

# Deploy any container - no Kubernetes configuration required
gcloud run deploy my-service   --image us-central1-docker.pkg.dev/my-project/my-repo/my-service:latest   --platform managed   --region us-central1   --memory 512Mi   --cpu 1   --concurrency 80        # Requests per container instance
  --min-instances 0       # Scale to zero
  --max-instances 100   --set-env-vars "DATABASE_URL=$(gcloud secrets versions access latest --secret=db-url)"   --service-account my-service-sa@my-project.iam.gserviceaccount.com   --no-allow-unauthenticated  # Require auth for internal services

Firestore Data Modeling

// Firestore is NoSQL - model for your query patterns, not for normalisation
// Root collections → documents → subcollections

// ✅ Good: query by userId and status
users/{userId}/orders/{orderId}
  { status: 'pending', totalCents: 2999, createdAt: Timestamp }

// Index for: collection group query across all users' orders
// db.collectionGroup('orders').where('status', '==', 'pending').orderBy('createdAt')

import { getFirestore, collection, query, where, orderBy, limit, getDocs } from 'firebase/firestore';
const db = getFirestore();

const recentOrders = await getDocs(
  query(
    collection(db, 'users', userId, 'orders'),
    where('status', '==', 'pending'),
    orderBy('createdAt', 'desc'),
    limit(20)
  )
);

// Firestore limits:
// - 1 write per document per second (for a single doc)
// - Max document size: 1MB
// - Max 100 writes per transaction/batch

BigQuery Analytics Pattern

-- BigQuery: SQL on petabytes, pay per query, no index needed
-- Partition and cluster to reduce bytes scanned (= cost)

CREATE TABLE analytics.events
PARTITION BY DATE(created_at)    -- Partition by date - reduces scan per day filter
CLUSTER BY event_type, user_id   -- Clustering for common filter columns
AS SELECT * FROM ...;

-- Cost-optimised query: always filter on partition column first
SELECT
  event_type,
  COUNT(*) AS event_count,
  COUNT(DISTINCT user_id) AS unique_users
FROM analytics.events
WHERE DATE(created_at) BETWEEN '2026-08-01' AND '2026-08-19'  -- Partition pruning
  AND event_type IN ('purchase', 'signup')
GROUP BY event_type;
-- Without partition filter: scans entire table → 10× cost

Explore all agents

Browse the full library of specialized AI agents.