This answer may be too late for you, but I am leaving an answer here just in case it can help someone else.
As pointed out by @Kenworth, the documentation page about Restoring a Cloud SQL instance contains all the information related to how that can be achieved and what are its implications.
However, it seems that both the gcloud
and Console approaches did not work for you, so you need to try with something else, which can be making API calls for restoring the desired backup. You can do that in two ways:
Using curl
:
Get an access token, then list the available backups for the instance, and finally restore it.
echo "Getting Access Token"
ACCESS_TOKEN="$(gcloud auth print-access-token)"
echo "List available backups for the instance [INSTANCE_NAME] in [PROJECT_ID]"
curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
-X GET \
https://www.googleapis.com/sql/v1beta4/projects/[PROJECT_ID]/instances/[INSTANCE_NAME]/backupRuns
echo "Restore backup [BACKUP_ID] in instance [INSTANCE_NAME] in [PROJECT_ID]"
curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header 'Content-Type: application/json' \
--data '{ "restoreBackupContext": {"backupRunId": "[BACKUP_ID]"}}' \
-X POST \
https://www.googleapis.com/sql/v1beta4/projects/[PROJECT-ID]/instances/[INSTANCE_NAME]/restoreBackup
Using APIs Explorer:
It is the same as with the CURL command, but you have a web UI to make the API calls. First list the available backups, then choose the one you want to restore, and finally restore it.
If you still have problems with restoring a backup in your Cloud SQL instance, you should contact Google Cloud Platform Support in order for us to be able to help you further.