Reputation: 1120
I have a Compute Engine instance with Postgres running on project1. I want to migrate that to the fully managed postgres provided by Google Cloud SQL environment, on project2, so a different project. To do so, I have SSHed into my VM instance and dumped the database to a file.
Now I want to restore the DB into Google Cloud SQL on project2.
I was thinking about saving the file to a project1's Storage Bucket and then move it somehow to project2, but I don't know how to copy a bucket from project1 to project2.
Upvotes: 4
Views: 4948
Reputation: 674
The quickest way I think of doing it from where you stopped is,
After dumping the file, in your SSH session, check what service account is activated on the instance.
$ gcloud auth list
Copy the account marked ACTIVE
- [email protected] ACTIVE
Copy the dump file from your instance to bucket on project2
$ gsutil cp /home/user/dump.gz gs://bucket-on-project2/
If you just want to tansfer files between buckets:
Using the browser, You can navigate to Storage->Transfer in the Cloud Console.
Using th CloudSDK and considering you have the right write/read permissions for both buckets on both projects.
$ gsutil cp gs://bucket-on-project1/dump.gz gs://bucket-on-project2/
Upvotes: 5