{"id":20135553,"url":"https://github.com/raisely/cloudsql-restore","last_synced_at":"2026-06-12T07:32:56.007Z","repository":{"id":69521180,"uuid":"283863663","full_name":"raisely/cloudsql-restore","owner":"raisely","description":"Utility to restore cloudsql across projects","archived":false,"fork":false,"pushed_at":"2022-04-14T20:47:11.000Z","size":30,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-02T22:41:37.486Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raisely.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-30T19:47:40.000Z","updated_at":"2024-06-25T10:28:15.000Z","dependencies_parsed_at":"2023-02-26T04:31:46.230Z","dependency_job_id":null,"html_url":"https://github.com/raisely/cloudsql-restore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/raisely/cloudsql-restore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raisely%2Fcloudsql-restore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raisely%2Fcloudsql-restore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raisely%2Fcloudsql-restore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raisely%2Fcloudsql-restore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raisely","download_url":"https://codeload.github.com/raisely/cloudsql-restore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raisely%2Fcloudsql-restore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34234557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T21:15:33.479Z","updated_at":"2026-06-12T07:32:55.992Z","avatar_url":"https://github.com/raisely.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a utility to help restore CloudSQL backups accross projects as per the documentation here\nhttps://cloud.google.com/sql/docs/postgres/backup-recovery/restoring\n\nThis has only been tested against Postgres, your results may vary for other database engines.\n\n# Usage\n\n```js\nconst SqlRestore = require('cloudsql-restore');\n\nrestoreHelper = new SqlRestore();\nrestoreHelper.authorizeJwt('./test-service-account.json');\n\nbackups = await restoreHelper.listBackups({\n\tprojectId: sourceProjectId,\n\tinstanceId: sourceInstanceId,\n});\n\nawait restoreHelper.restoreBackup({\n\tsourceProjectId,\n\tsourceInstanceId,\n\ttargetProjectId,\n\ttargetInstanceId,\n\t// An id of a run returned by listBackups\n\tbackupRunId,\n});\n\n// Restores the most recent backup\nawait restoreHelper.restoreLatestBackup({\n\tsourceProjectId,\n\tsourceInstanceId,\n\ttargetProjectId,\n\ttargetInstanceId,\n});\n```\n\nHere's an example of the output returned by listBackups\n\n```js\n[{\n\tkind: 'sql#backupRun',\n\tstatus: 'SUCCESSFUL',\n\tenqueuedTime: '2020-07-24T14:52:14.591Z',\n\tid: '1595599200001',\n\tstartTime: '2020-07-24T14:52:14.750Z',\n\tendTime: '2020-07-24T14:54:20.016Z',\n\ttype: 'AUTOMATED',\n\twindowStartTime: '2020-07-24T14:00:00Z',\n\tinstance: 'demo-instance',\n\tselfLink:\n\t'https://www.googleapis.com/sql/v1beta4/projects/demo-project/instances/demo-instance/backupRuns/1595599200001',\n\tlocation: 'asia',\n\tbackupKind: 'SNAPSHOT'\n}]\n```\n\n# Service Account \u0026 Roles\n\nTo limit the scope of the service account, you may want to create custom roles so you can grant reading of backups\nto the source project and restoring of backups to the target project.\n\nYou should [review the permissions](https://cloud.google.com/sql/docs/postgres/project-access-control) needed to backup/restore instances.\n\nHere's the permissions we've found work for backing up/restoring:\n\nFor your source project to list and access the backups:\n```\ncloudsql.instances.get\ncloudsql.instances.list\ncloudsql.backupRuns.list\ncloudsql.backupRuns.get\n```\n\nFor your target project to restore a backup to it\n```\ncloudsql.instances.get\ncloudsql.instances.list\ncloudsql.instances.restoreBackup\n```\n\n# Troubleshooting\n\nSome common errors you might encounter\n\n**The client is not authorized to make this request**\nMost likely a permissions error, check IAM.\n\n**This operation is not valid for this instance**\nThis error might occur if the target instance does not have enough storage to accommodate the backup. Try increasing storage to be the same as the source instance.\n\n# License\n\nLicensed under the [NoHarm license](./LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraisely%2Fcloudsql-restore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraisely%2Fcloudsql-restore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraisely%2Fcloudsql-restore/lists"}