Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/taxintt/cloudsql-restore-workflow


https://github.com/taxintt/cloudsql-restore-workflow

gcp workflows

Last synced: 15 days ago
JSON representation

Awesome Lists containing this project

README

        

# 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

```bash
❯ gcloud sql backups list --project --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
```

2. Setup infra

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

```bash
cd infra
terraform apply -var project=""
```

3. Run a job of cloud scheduler (`sample-scheduler-job`)

4. Confirm the result

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

```
❯ gcloud sql backups list --project --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
```