ONE MACHINE on Google Cloud: private data, a warm standby in Delhi, and AI only where it pays

A fault-tolerant design for machine tracking and health management in regulated plants (pharma first). Machines publish through an outbound-only edge gateway; 13 microservices sit behind one api-gateway on a private GKE cluster; every database has a private address only; Mumbai runs across three zones and Delhi holds a scaled-down copy that can take over in about 30 minutes. Pick a flow below and press Play.

13services behind one api-gateway (12 domain + gateway)
0public database endpoints (enforced by org policy)
2 × 3India regions × zones: Mumbai primary, Delhi standby
30 min / ≤1 minRTO / RPO for a region loss; telemetry RPO 0
12k/stelemetry points at the sizing assumption
$10.1klist per month, before the cost options

Step 1The architecture, one flow at a time

1

    Red = the hop playing now. Moving dashes = the rest of this flow. Arrow keys step. Scroll sideways on a phone.

    Service icons are the vendors' published diagram icons, shown only to identify each service.

    Step 2Twelve domain services, one gateway, one owner per table

    api-gateway (Node.js, the existing main-server pattern) is the only thing the load balancer can reach. It verifies the Identity Platform token, checks the user's client, plant, line and role, applies rate limits, and calls the services over in-cluster HTTP. No service reads another service's database; they talk through the gateway, Pub/Sub events or RabbitMQ jobs.

    ServiceCodeOwnsTalks toScales on
    api-gatewayNode.jsno store (reads Redis)all 12 services, Identity Platform keysHPA on CPU and requests
    Asset RegistryNode.jsMySQL: clients, plants, lines, machines, tags (ISA-95 tree)gatewayHPA
    IngestPythonTimescaleDB hypertables, Redis latest valuesPub/Sub telemetry subscriptionKEDA on Pub/Sub backlog, Spot nodes
    Machine HealthPythonTimescaleDB health scores, rulespublishes machine.health.changedKEDA on backlog
    Alarms & EventsNode.jsMongoDB alarms (ISA-18.2 states)Pub/Sub in, RabbitMQ outHPA
    Predictive AIPythonreads TimescaleDB features; model from Vertex AI registrypublishes machine.risk.predicted5-minute CronJob + HPA, CPU only
    Work OrdersNode.jsMySQL CMMS tablesRabbitMQ in, ERP/MES syncHPA
    OEEPythonTimescaleDB continuous aggregatesgatewayHPA
    CalibrationNode.jsMySQL calibration, IQ/OQ/PQ recordsAudit & e-SignHPA
    Audit & e-SignNode.jsMongoDB audit (insert-only, hash-chained), sealed copies in a locked bucketIdentity Platform re-authenticationHPA, min 3 replicas
    ReportsPythonPDFs in Cloud StorageRabbitMQ jobsKEDA on queue, Spot nodes
    NotificationsNode.jsRedis de-duplication keysRabbitMQ in; Teams, email, SMS outKEDA on queue
    AI CopilotPythonpgvector database (on the TimescaleDB cluster), MongoDB conversationsVertex AI Gemini; gateway APIs as toolsHPA, capped by token budget

    Tenancy: one platform for many client companies. Every row carries client_id, each client gets its own database in MySQL and MongoDB and its own schema in TimescaleDB, and the gateway rejects a token whose client does not match the request. A client that demands full isolation gets its own project from the same Terraform.

    Step 3Data tier: private addresses only, and each store has one job

    StoreRuns asUsed byZone failureRegion failureAccess
    Cloud SQL for MySQLEnterprise Plus, private IP (private services access), CMEKAssets, Work Orders, CalibrationHA standby in a second zone, automatic failoverDR replica in Delhi; the write endpoint follows a failoverIAM database auth through the Cloud SQL connector
    MongoDB (self-hosted)GKE StatefulSet via operator, 3 members in 3 zones, dedicated node poolAlarms, Audit, Copilot historymajority writes survive one zone2 priority-0 members in Delhi, promoted by forced reconfigNetworkPolicy to owner pods only, SCRAM + TLS
    TimescaleDBCloudNativePG cluster, 3 instances in 3 zones, WAL archived to Cloud StorageIngest, Health, OEE, Predictive AI; pgvector DB for Copilotsynchronous standby, operator failoverCNPG replica cluster in Delhiper-service roles, NetworkPolicy
    Memorystore for Redis Clustermulti-zone, private connectivitygateway, Ingest, Copilot cachereplica per shardcross-region secondary (switchover)IAM auth + in-transit TLS
    RabbitMQCluster Operator, 3 nodes, quorum queuesAlarms, Work Orders, Reports, Notificationsquorum keeps 2 of 3definitions in Git; producers re-drive open jobsTLS, NetworkPolicy
    Pub/Subglobal service, message storage policy limited to Mumbai and DelhiIngest, Health, Alarms, Predictive AIGoogle-managedkeeps publishing; 7-day retention allows replayPrivate Service Connect + VPC Service Controls
    Cloud Storageconfigurable dual-region IN (Mumbai + Delhi)UI, exports, models, reports, audit seals, backups—data already in both regionsuniform access, public access prevention, CMEK

    Why TimescaleDB and not MySQL for telemetry: hypertables, native compression and continuous aggregates turn a billion points a day into small, fast rollups. Why RabbitMQ and Pub/Sub both: Pub/Sub carries high-volume telemetry and fan-out events; RabbitMQ carries work that must run exactly once in order (create this work order, render this report).

    Step 4Security: nothing public except the load balancer

    Network

    • One Shared VPC; GKE private nodes and a private control-plane endpoint.
    • Org policies block external IPs on VMs and public IPs on Cloud SQL.
    • Google APIs only through a Private Service Connect endpoint; Private Google Access on.
    • Egress only through Cloud NAT, with Cloud NGFW egress rules naming the few outside hosts (Teams, Sentry, SMS gateway).
    • Kubernetes NetworkPolicies: each database accepts only its owner pods.

    Plants (OT side)

    • The edge gateway sits in the plant DMZ and only opens outbound connections. Nothing in the cloud can connect into the OT network.
    • The platform is read-only toward machines: there is no write path to a PLC or setpoint.
    • Two HA VPN tunnels per plant, BGP via Cloud Router, firewall rules per plant range.

    Identity and secrets

    • Users: Identity Platform with each client's SAML/OIDC IdP and MFA; signing an e-record forces re-authentication.
    • Workloads: Workload Identity Federation for GKE; service-account key creation disabled by org policy.
    • Secrets in Secret Manager, mounted through the GKE add-on; CMEK with Cloud KMS on SQL, disks, buckets, Pub/Sub and Redis.
    • Grafana, Jenkins and GitLab only through IAP or the office VPN.

    Perimeter, supply chain, detection

    • VPC Service Controls around Cloud Storage, Pub/Sub, Vertex AI, Secret Manager, KMS, Artifact Registry and Cloud SQL Admin.
    • Cloud Armor: OWASP rules, per-client rate limits, India-plus-allow-list geo policy.
    • Artifact Registry scanning + Binary Authorization: only signed, attested images run.
    • Security Command Center for posture and findings; Data Access audit logs on for SQL and Storage, routed to a locked bucket.
    • Org policy limits resource locations to Mumbai and Delhi (DPDP Act and client data-residency terms).

    Step 5Fault tolerance and DR: lose a zone without noticing, lose Mumbai in 30 minutes

    Inside Mumbai everything spans three zones, so a zone loss is absorbed automatically. For a region loss, Delhi already holds the data (continuous replication) and a small running cluster; the global load balancer and Pub/Sub are global, so users and plants need no DNS change.

    LayerZone lossRegion loss (to Delhi)RPORTO
    Plant telemetry—72-hour edge buffer; standby tunnels to Delhi; Pub/Sub keeps accepting00
    GKE workloadsregional cluster, PodDisruptionBudgets, spread across zonesDelhi cluster at minimum size scales out; LB health checks shift traffic—10–15 min
    Cloud SQL MySQLHA failoverreplica failover of the DR replica; write endpoint movessecondsminutes
    MongoDBreplica set electionforced reconfig to the Delhi membersseconds~10 min
    TimescaleDBCNPG failoverpromote the Delhi replica clusterseconds~10 min
    Redisreplica promotionswitchover to the secondary (or rebuild from source)secondsminutes
    RabbitMQquorum queuescluster from Git definitions; open jobs re-driven from MySQL/MongoDB0 (re-driven)15 min
    Cloud Storage—dual-region, nothing to do0–minutes0
    GitLab, Jenkinsdaily snapshotsrebuilt in Delhi from Terraform + backups24 h4 h

    Drills: a zone-drain game day every month and a full Delhi switchover every quarter (Cloud SQL switchover returns with no data loss). A DR plan that has not been switched over is a guess.

    Step 6AI in four tiers: cheapest model that does the job

    1 · Edge rules (free)

    Deadband filters, limits and a tiny anomaly model on the gateway. Most readings never need a cloud model, and fewer messages leave the plant.

    2 · Classical ML on CPU (most predictions)

    Per machine-class anomaly and remaining-useful-life models run inside the Predictive AI pods on ordinary nodes every 5 minutes. No GPU, no always-on prediction endpoint.

    3 · Vertex AI pipelines (weekly)

    Training on Spot capacity from Parquet in Cloud Storage; a new model is registered only if it beats the current one on last quarter's real failures. Drift is watched in Grafana.

    4 · Gemini for language only

    Copilot answers with citations from SOPs and manuals, alarm-flood summaries per shift, handover notes and deviation drafts. Gemini Flash in Mumbai, where Google lists in-region ML processing for India; small-model routing, a semantic cache, context caching, batch mode for nightly summaries, and a monthly token budget per site.

    Guardrails for GxP: AI suggests, people decide. It never signs, closes a deviation, schedules downtime or touches a machine; every prompt, source and answer is kept with the audit trail.

    Step 7FinOps and GreenOps built into the design

    FinOps by design

    • Labels on everything: client, site, service, env. GKE cost allocation on; billing export for showback per client.
    • One unit metric: cost per monitored machine per month, reviewed monthly with budgets and alerts per project.
    • Telemetry never passes the load balancer; the UI is static on CDN; no per-machine streams or endpoints.
    • Spot for everything that can restart: Ingest workers, Reports, Jenkins agents, training.
    • DR is sized to run, not to idle: the Delhi cluster also runs nightly batch work.

    GreenOps

    • Google's figures put Delhi at about 29% carbon-free energy against about 9% in Mumbai, so batch work (training, exports, report rendering) runs in Delhi, on the standby cluster that already exists.
    • Edge deadband and batching cut messages, compression cuts disk; less data moved and stored is less energy.
    • Scale to zero at night: CI agents, report workers and non-production clusters.
    • Carbon Footprint export reviewed monthly next to cost: kg CO₂e per monitored machine.
    • Idle-resource recommenders acted on in the same monthly review.

    Step 8Sizing assumption and the list-price starting point

    Assumed load: 25 plants, 1,500 machines, 40 tags per machine sampled every 5 s on average (12,000 points/s, about 1 billion a day), 400 concurrent users, about 5,000 copilot questions a day. Change these and the sizes below change with them.

    LineShapeUSD / month

    Indicative list prices, Dec 2026. Compute prices are third-party trackers' asia-south1 figures; Cloud SQL and Memorystore use Google's published rates without confirming the Mumbai column; VPN is $0.05 per tunnel hour. Confirm in the Google Cloud Pricing Calculator before budgeting. INR at ₹93.5 per USD. Sentry SaaS is outside this total.

    Cost flow: where the money goes, list price against after the recommended options

    Monthly cost in USD (₹ at 93.5 per dollar). Money flows left to right: from where it is spent, to what it buys, to the monthly total. Switch between list price and the recommended set from step 9. Ribbon width is proportional to dollars; hover a ribbon for its amount.

    Step 9Cost optimization options: tick what you accept, see the bill move

    Each option shows its saving against the list baseline and what it costs you in risk or effort. Savings multiply, so the total is not a plain sum of the rows.

    Not in the calculator

    • Arm nodes (C4A/T2A) for Node.js and Python images, where offered in Mumbai: usually better price-performance; needs multi-arch builds.
    • Non-production on a schedule: dev and QA clusters off nights and weekends removes roughly two thirds of their hours.
    • Topology-aware routing in GKE to keep calls inside one zone and cut inter-zone transfer.
    • Security Command Center premium tiers and Cloud Armor Enterprise only when a client contract requires them.
    Estimated monthly bill
    $0
    List baseline
    With selected options

    Biggest lines after options

    Step 10GxP: what a pharma auditor will ask, and where the answer lives

    RequirementHow ONE MACHINE meets it
    Audit trail (21 CFR Part 11, EU GMP Annex 11)Audit & e-Sign: who, what, when, old and new value, reason; insert-only, hash-chained, sealed nightly to a locked bucket.
    Electronic signaturesRe-authentication with MFA at the moment of signing; signature meaning (reviewed, approved) stored with the record and printed on the PDF.
    Data integrity (ALCOA+)Attributable users only (no shared accounts), server-side NTP time, originals kept (raw telemetry plus rollups), retention per client contract.
    Validated stateInfrastructure only through Terraform and reviewed merge requests (the change record); plan/apply logs and test runs archived as qualification evidence.
    Access reviewsClient IdP groups map to roles; quarterly review export from Identity Platform and IAM.
    Business continuitySection 5 targets, tested by quarterly switchover with a signed report.

    Step 11Build order

    1. Organization, folders, projects (prod, DR shares prod, tools, security, non-prod); org policies (locations, no public IPs, no SA keys); billing export, budgets, labels.
    2. Shared VPC with subnets in Mumbai and Delhi, Cloud Router, Cloud NAT, NGFW rules, PSC endpoint for Google APIs, private services access range.
    3. Cloud KMS keys, Secret Manager, VPC Service Controls perimeter (dry-run first, then enforce).
    4. Tools project: GitLab and Jenkins on Compute Engine behind IAP; Terraform state in a versioned bucket.
    5. GKE regional private clusters in Mumbai and Delhi: system, app, Spot and stateful node pools; Workload Identity; Binary Authorization.
    6. Data: Cloud SQL Enterprise Plus with HA + Delhi DR replica; Memorystore cluster + secondary; operators for MongoDB, CloudNativePG (TimescaleDB) and RabbitMQ; Delhi members and replica cluster.
    7. Pub/Sub topics with storage policy, dead-letter topics; Cloud Storage dual-region buckets with lifecycle rules and a locked audit bucket.
    8. Edge: HA VPN per plant, gateway image (OPC UA collector, buffer, deadband), outbound-only firewall in the plant DMZ.
    9. CI/CD: Jenkins pipelines, scans, Artifact Registry, attestations, Helm releases to both clusters.
    10. Front door: Cloud DNS, Certificate Manager, global load balancer with container-native NEGs, Cloud Armor, Cloud CDN for the React UI; Identity Platform with the first client's IdP.
    11. Observability: OpenTelemetry collector, Managed Prometheus, Grafana, Cloud Logging sinks and exclusions, Sentry, SLO alerts to Teams.
    12. Vertex AI: pipeline, model registry, Gemini access with budgets; then the first zone-drain and Delhi switchover drill before go-live.

    Step 12Decided, and still open

    Decided

    • Mumbai primary: Gemini models with in-India ML processing are listed for asia-south1; Delhi is the standby and the greener home for batch work.
    • GKE Standard (not Autopilot) for dedicated stateful and Spot node pools.
    • MongoDB stays self-hosted, as today; TimescaleDB through CloudNativePG.
    • Warm standby rather than active-active: half the cost, 30-minute RTO.

    Open

    • Plant count, tags and sample rates per client (drives every size above).
    • VPN for every plant, or internet + mTLS for telemetry-only plants (biggest cost lever, a client-security decision).
    • Cloud SQL Enterprise Plus vs Enterprise (write endpoint and faster DR vs about a quarter less).
    • Sentry SaaS region, or self-hosted Sentry, if a client requires all logs in India.
    • Record retention years per client, which sets archive storage.

    Sources