Giter Site home page Giter Site logo

cloudsql-restore-workflow's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.