tech/google

GOOGLE

Google platform skills. Shared OAuth 2.0 / service-account model spanning Google Cloud (GCP) and Google Workspace. Use skills in this domain when:

production
improves: tech

Google Platform

Google runs two overlapping product families under one identity plane:

Both share OAuth 2.0 and service-account authentication and live under Cloud IAM, but the consent flows, scopes, and administrative domains differ. A Workspace admin grants domain-wide delegation to a GCP service account; a GCP IAM binding grants that same service account access to BigQuery. The two planes meet at the service-account identity.

In the 2nth.ai stack, GCP is the second-tier compute substrate alongside AWS — used when a workload needs Vertex AI (Gemini, embeddings), BigQuery analytics, or deep Workspace integration. Workspace APIs run through Gmail/Drive/Sheets automations that back Penny briefings and client intake flows.

Sub-skills

PathFocusStatus
tech/google/cloudGCP parent — projects, IAM, regions, gcloud CLI✓ production
tech/google/cloud/computeCloud Run, Cloud Functions, GKE, Compute Engine✓ production
tech/google/cloud/aiVertex AI, Gemini, embeddings, AI Studio✓ production
tech/google/cloud/dataBigQuery, Pub/Sub, Dataflow, Dataproc✓ production
tech/google/cloud/securityIAM, Secret Manager, KMS, Cloud Armorstub
tech/google/cloud/storageCloud Storage, Filestore, Transfer Servicestub
tech/google/cloud/databaseCloud SQL, Spanner, Firestore, AlloyDB, Bigtablestub
tech/google/cloud/networkingVPC, Load Balancing, Cloud CDN, Cloud DNSstub
tech/google/workspaceWorkspace parent — domain-wide delegation, scopes✓ production
tech/google/workspace/gmailGmail API — read, send, label, Watch pipeline, AI automation✓ production
tech/google/workspace/driveDrive API v3 — files, folders, permissions, shared drivesstub
tech/google/workspace/sheetsSheets API v4 — read, append, batch update, formulasstub
tech/google/workspace/calendarCalendar API v3 — events, availability, push notificationsstub
tech/google/workspace/adminAdmin SDK — users, groups, domain-wide delegation managementstub

Authentication model

Google uses OAuth 2.0 for user-delegated access and service accounts for server-to-server. Both sit on top of Cloud IAM. The choice depends on whose data you are accessing:

IdentityUse caseCredential
User OAuthUser authorises your app to access their Gmail/Drive/Sheetsaccess_token + refresh_token, OAuth consent screen
Service accountServer code accessing project-owned GCP resources (BigQuery, GCS, Pub/Sub)JSON key OR Workload Identity Federation
Service account + DWDWorkspace domain data (all users in example.com)JSON key + Workspace admin grants domain-wide delegation to the SA's OAuth client ID
Workload IdentityGKE / Cloud Run / Cloud Functions — no static keyAutomatic token exchange via metadata server
Workload Identity FederationExternal IdPs (AWS, Okta, GitHub OIDC)Trust policy on the SA, short-lived tokens

Golden rule: Never put a service-account JSON key in application code running on Google Cloud compute. Always use the attached service account via the metadata server. Keys are only for local dev, CI secrets, or cross-cloud.

gcloud CLI setup

# Install (macOS)
brew install --cask google-cloud-sdk

# Interactive login (user credentials)
gcloud auth login

# Application Default Credentials (what SDKs read)
gcloud auth application-default login

# Set the active project
gcloud config set project my-project-id
gcloud config set compute/region africa-south1
gcloud config set run/region africa-south1

# Verify
gcloud config list
gcloud auth list
gcloud projects list

Service account (server-to-server)

# Create service account
gcloud iam service-accounts create my-sa \
  --display-name "My Service Account" \
  --project my-project-id

# Grant a role (project-level)
gcloud projects add-iam-policy-binding my-project-id \
  --member "serviceAccount:[email protected]" \
  --role "roles/bigquery.dataViewer"

# Generate JSON key (local dev / CI only — prefer Workload Identity for runtime)
gcloud iam service-accounts keys create ~/.keys/my-sa.json \
  --iam-account [email protected]

# Use the key
export GOOGLE_APPLICATION_CREDENTIALS=~/.keys/my-sa.json

Workload Identity Federation (no JSON keys)

Federate an external IdP (AWS STS, GitHub OIDC, Okta) to impersonate a GCP service account without a downloadable key. The canonical pattern for GitHub Actions deploying to GCP:

# Pool + provider
gcloud iam workload-identity-pools create github \
  --location global --display-name "GitHub Actions"

gcloud iam workload-identity-pools providers create-oidc github-oidc \
  --location global --workload-identity-pool github \
  --issuer-uri "https://token.actions.githubusercontent.com" \
  --attribute-mapping "google.subject=assertion.sub,attribute.repository=assertion.repository"

# Bind the SA
gcloud iam service-accounts add-iam-policy-binding \
  [email protected] \
  --role roles/iam.workloadIdentityUser \
  --member "principalSet://iam.googleapis.com/projects/NUM/locations/global/workloadIdentityPools/github/attribute.repository/my-org/my-repo"

Project / organisation hierarchy

Organization (example.com)
 ├── Folder: production
 │   ├── Project: my-app-prod          ← where compute runs
 │   └── Project: my-data-prod
 ├── Folder: staging
 │   └── Project: my-app-staging
 └── Project: shared-services           ← central logging, billing, DNS

IAM bindings cascade downward. Grant narrowly — at the project or resource level, not the org level, unless you have org-admin reasons.

Regions for SA / Africa clients

RegionCodePOPIA fit
Johannesburgafrica-south1✓ SA data residency
Londoneurope-west2GDPR + documented SA transfer basis
Belgiumeurope-west1GDPR EU fallback
Iowaus-central1Avoid for SA personal data

Cloudflare + GCP hybrid pattern

User request
    → Cloudflare Worker (edge auth, rate limit, cache)
         → Cloud Run service (europe-west2 or africa-south1)
              → BigQuery (analytics)
              → Vertex AI Gemini (inference)
              → Cloud SQL / Firestore (persistence)
              → Gmail API via Workspace DWD (user comms)

Cloud Run is the closest GCP analogue to Cloudflare Workers + AWS Lambda — pay-per-request, scale to zero, container-based. For real-time streaming AI inference, Vertex AI endpoints sit behind Cloud Run.

See Also