A tool for quickly migrating CloudSQL instances to each other.
To run a migration, simply run:
migrate \
--src-project= \
--src-instance= \
--dst-project= \
--dst-instance=S
Under the hood it heavily uses the CloudSQL Admin API to:
-
Create an on-demand snapshot of the source instance
-
Restore that snapshot in the target CloudSQL instance.
This approach is favorable the classic sql export-import flow for a couple reasons:
-
It's much faster ⚡. The time to create and restore snapshots are quite well optimized is inversely proportional to the instance's resources.
-
It's safer 🔒 as data does not persist on a temporary bucket but on snapshots that are best practices to have anyways. On top of that, users with their credentials, database schemas, permissions, extensions are preserved and transferred without issue from the source to the target instance.
-
It's simpler 👶; Not having to deal with the complexities of dumping and importing SQL (e.g. extension, user permission and other issues that arises from the lack of control of the dump generated)
-
Does not stress the source instance if automated backups is enabled. The latter is incremental thus generating a new snapshot from the last point in time is significantly faster and less resource intensive than performing an sql dump.
Build your and install own binary with:
go install github.com/ichbinfrog/cloudsqlmigrate