Learning Objectives
By the end of this chapter, you will be able to:
- Provision regional HA, cross-region replica, and multi-region topologies for each managed database service through gcloud, the REST API, and Terraform.
- Run scheduled failover and DR rehearsals with documented preconditions, success gates, and rollback paths.
- Configure multi-regional replication for Cloud SQL, AlloyDB, Spanner, Bigtable, and Firestore, then validate the resulting consistency, RPO, and RTO.
- Size read replica fleets against measured read QPS, replication lag tolerance, and the chosen routing strategy.
- Automate database provisioning through Terraform modules, Cloud Build pipelines, Cloud Deploy, Workflows runbooks, and Config Connector.
- Wire Cloud Monitoring, Cloud Logging, and the SLO service to instance vitals and replication state so that HA degradations page on-call before customers notice.
Executive Summary
- HA is a deployment property, not a service tier. Each engine encodes HA differently, and the provisioning command set, IAM, and limits change per engine.
- Periodic failover rehearsals are part of the deployment contract. An untested standby provides no real guarantee, so the runbook bakes in scheduled failovers, restore drills, and replication-lag injection tests.
- Multi-region posture trades write latency for cross-region durability. Spanner multi-region pays a Paxos round-trip per write, while Cloud SQL and AlloyDB cross-region paths are asynchronous and bound by replication lag.
- Read replica sizing follows a measurable formula tied to read QPS, per-node QPS budget, replica restart headroom, and routing strategy.
- Provisioning is automated through Terraform, Cloud Build, Cloud Deploy, and Workflows. The gcloud command surface is reserved for break-glass operations and verification.
- HA monitoring rests on four pillars: instance availability, replication topology health, replication lag against budget, and customer-observed error rate. Each pillar needs an SLI, an alert policy with burn-rate windows, and a dashboard.
Assumptions
- The reader has completed chapters 1 through 3, so capacity planning, IAM, monitoring primitives, backup taxonomy, migration mechanics, and engine selection heuristics are not redefined here.
- All examples place production resources in a dedicated project under an organization, with billing exports active, organization policy already enforcing
gcp.resourceLocations, and a Cloud KMS key ring provisioned per region. - gcloud commands assume an active project set through
gcloud config set project. Terraform examples assume a state backend in a Cloud Storage bucket with object versioning enabled and a service account configured for the runner.
