Skip to content

taxintt/cloudsql-restore-workflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

cloudsql-restore-workflow

This is a sample for restore of Cloud SQL instance.

  • Restore database from backup
  • Execute sql statements (by using cloud functions)
  • Create a backup of the database
  1. Prepare an initial backup of cloud sql instance
❯ gcloud sql backups list --project <project_name> --instance sample-instance-v1-for-backup

ID             WINDOW_START_TIME              ERROR  STATUS      INSTANCE
1654919319590  2022-06-11T03:48:39.590+00:00  -      SUCCESSFUL  sample-instance-v1-for-backup
  1. Setup infra

Note Specify cloud sql instance id (sample-instance-v1-for-backup) and backup id (1654919319590) in infra/workflows/restore_db.yaml

cd infra
terraform apply -var project="<gcp_project_id>"
  1. Run a job of cloud scheduler (sample-scheduler-job)

  2. Confirm the result

Note Check the instance name that is created with random suffix by using cloud logging.

❯ gcloud sql backups list --project <project_name> --instance sample-instance-v1-1654996390
ID             WINDOW_START_TIME              ERROR  STATUS      INSTANCE
1654996758862  2022-06-12T01:19:18.862+00:00  -      SUCCESSFUL  sample-instance-v1-1654996390

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published