Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share and restore cloud sql backup files across account ( project )

How can I Share and restore cloud sql backup files across account ( project )

like image 321
pythonhmmm Avatar asked Feb 05 '18 10:02

pythonhmmm


2 Answers

For those that stumble across this post 2018. It is now possible to restore cloudSQL between projects. As of this post you still need to use curl but it does work. The link below is to the mysql docs but I got it to work fine with SQL Server.

https://cloud.google.com/sql/docs/mysql/backup-recovery/restoring#projectid

like image 141
George B Avatar answered Oct 19 '22 23:10

George B


Unfortunately, you cannot restore an instance using a backup created in a different project, as stated in the documentation for instance restoration:

When you are restoring a backup to a different instance, keep in mind the following restrictions and best practices:

  • You cannot restore an instance using a backup taken in a different GCP project.
  • ...

Maybe the following is not your specific use case, but should you replicate your instance in a new project, you should follow these steps: export your data to a SQL dump or CSV file, and then import it in a new instance in your other project. Here it is a more detailed guide on how to achieve that:

  1. Export data from your current Cloud SQL instance in a format that can be later usable by Cloud SQL.
  2. Create a new Cloud SQL instance in the project of your choice. Select the same characteristics as the one in your current instance, or the ones that fit your future requirements better.
  3. Create the databases and tables in your new instance.
  4. Import the previously created dump/CSV file to the new instance [4].

Once these steps are completed, you should have a new Cloud SQL instance with the same data as the one in the old instance at the moment of creation of the export files.

However, as I already said, this is not restoring from a backup, so you cannot recover a previous instance state into an instance in a different project.

like image 39
dsesto Avatar answered Oct 20 '22 00:10

dsesto