Prerequisites
- GCP Cloud SQL PostgreSQL instance
- Access to Google Cloud Console
- Xata account and project setup
- Network access to your Cloud SQL instance
Install and Configure the Xata CLI
Install the Xata CLI:Network Configuration
Option 1: Public IP (Less Secure)
If your Cloud SQL instance has a public IP:- Authorize Your IP:
- Go to your Cloud SQL instance → “Connections” → “Networking”
- Add your IP address to “Authorized networks”
- Or temporarily add
0.0.0.0/0
for migration (remove after)
Option 2: Private IP (Recommended)
For better security, use private IP:-
Enable Private IP:
- Go to your Cloud SQL instance → “Connections” → “Networking”
- Enable “Private IP”
- Configure VPC peering if needed
-
Run Migration from GCP:
- Use Cloud Run, Compute Engine, or Cloud Functions
- Ensure the service is in the same VPC as your Cloud SQL
Option 3: Cloud SQL Proxy
Use Cloud SQL Proxy for secure connections:Get Connection String
Initialize Xata Project
Set up your Xata project configuration:Configure the Migration
Set up your clone configuration with optional anonymization:Start the Migration
Begin the data transfer:Monitor Progress
Check the migration status:Verification
After migration, verify your data:-
Connect to Xata Branch:
-
Check Data Integrity:
- Test Relationships: Verify foreign key relationships work correctly
Next Steps
- Explore Xata branching for development workflows
- Learn about schema changes with zero downtime
- Set up continuous sync for ongoing replication