Any chance of restoring a deleted gcloud sql instance?

Viewed 962

Im obviously an idiot and I didn't sufficiently save data, but is there any chance of restoring a deleted gcloud sql instance that has been deleted, not just a db from backups because the whole instance has been deleted?

2 Answers

It's actually possible to recover them if you are quick enough. They should still be there, even when Google says they're deleted.

If you know the name of the deleted DB run the following command to check if they are still there

gcloud sql backups list --instance=deleted-db-name --project your-project-name

If you can see any results, you are lucky. Restore them ASAP!

gcloud sql backups restore <backup-ID> --restore-instance=new-db-from-scratch-name --project your-project

And that's it!

Further info: https://geko.cloud/gcp-cloud-sql-how-to-recover-an-accidentally-deleted-database/

To my knowledge, there is no undelete for Cloud SQL instances.

If you pay for Cloud Support, before you do anything else, you may wish to contact support to see whether someone on that team is able to salvage the instance for you.

Related