Can’t restore Google Cloud SQL instance

database-restoregoogle-cloud-platformgoogle-cloud-sql

I'm trying to restore my Google Cloud SQL instance to a backup from a previous date:

gcloud sql backups restore 1504554300110 --restore-instance=[MY-DB-INSTANCE]

Ultimately, it keeps giving an error:

ERROR: (gcloud.sql.backups.restore) HTTPError 503: Service temporarily unavailable.

I have been trying every day for a week now and continue to get the same error message. I have tried both the web UI and using the gcloud command and neither one seem to work. Anyone have any suggestions?

Best Answer

To restore a backup from the same instance:

gcloud sql backups restore [BACKUP_ID] --restore-instance=[INSTANCE_NAME]

To restore a backup from a different instance:

gcloud sql backups restore [BACKUP_ID] --restore-instance=[TARGET_INSTANCE_NAME] \
                                      --backup-instance=[SOURCE_INSTANCE_NAME]

Before you do the above, make sure to run:

gcloud sql backups list --instance [INSTANCE_NAME]

find the backup you want to use, record its ID value, and select a backup that is marked 'SUCCESSFUL'

Here is the complete documentation about Restoring an Instance.