This blueprint creates a Cloud SQL instance with multi-region read replicas as described in the Cloud SQL for PostgreSQL disaster recovery article.
The solution is resilient to a regional outage.
To get familiar with the procedure needed in the unfortunate case of a disaster recovery, please follow steps described in part two of the aforementioned article.
This repo is based on the Cloud Foundation Fabric blueprint available here.
Time to complete: About 16 minutes 30 sec.
Click the Start button to move to the next step
- Run the prerequisites script to enable APIs and set Cloud Build permissions.
sh prereq.sh- Run the Cloud Build Job
gcloud builds submit . --config ./build/cloudbuild.yamlNext we are going to test the architecture and finally clean up your environment.
- Initiate a failover to test Cloud SQL instance high availability. During this process, the instance will temporarily be unavailable for a few minutes while it switches over.
gcloud sql instances failover INSTANCE_NAME
- Verify that the Cloud SQL instance has high availability configuration.
gcloud sql instances describe INSTANCE_NAME
The output should indicate availability Type as REGIONAL. The GceZone and secondary GceZone fields should show the current primary and secondary zones of the instance
The easiest way to remove all the deployed resources is to run the following command in Cloud Shell:
gcloud builds submit . --config build/cloudbuild_destroy.yamlThe above command will delete the associated resources so there will be no billable charges made afterwards.
You’re all set!