Skip to content

Instantly share code, notes, and snippets.

@ianlintner
Last active December 23, 2022 18:32
Show Gist options
  • Save ianlintner/0b1eae81cf4bdaae206fac7476306dca to your computer and use it in GitHub Desktop.
Save ianlintner/0b1eae81cf4bdaae206fac7476306dca to your computer and use it in GitHub Desktop.
Google Cloud Sql Cross Project Restore Database with Curl
TOKEN=$(gcloud auth application-default print-access-token)
curl -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-X GET \
https://sqladmin.googleapis.com/sql/v1beta4/projects/example-project-1/instances/source-db/backupRuns
curl -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-X POST \
https://sqladmin.googleapis.com/sql/v1beta4/projects/example-project-2/instances/target-db/restoreBackup \
-d \
'
{
"restoreBackupContext":
{
"backupRunId": "12345",
"project": "example-project-1",
"instanceId": "source-db"
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment