Overview
This migration method involves:1
Setting up AWS DMS replication instance and endpoints
2
Configuring source and target database connections
3
Creating and running migration tasks with full load and CDC
4
Monitoring migration progress and performing cutover
NoteThis method requires an AWS account and will incur AWS DMS charges. Review AWS DMS pricing before proceeding.
NoteFor Aurora users: Consider the Aurora to PlanetScale CloudFormation & DMS tutorial for a fully automated approach using CloudFormation templates and Step Functions workflows instead of manual DMS setup.
Prerequisites
Before starting the migration:- Active AWS account with appropriate DMS permissions
- Source PostgreSQL database accessible from AWS (consider VPC configuration)
- Connection details for your PlanetScale for Postgres database from the console
- Ensure the disk on your PlanetScale database has at least 150% of the capacity of your source database. If you are migrating to a PlanetScale database backed by network-attached storage, you can resize your disk manually by setting the “Minimum disk size.” If you are using Metal, you will need to select a size when first creating your database. For example, if your source database is 330GB, you should have at least 500GB of storage available on PlanetScale.
- Understanding of your data transformation requirements (if any)
- Network connectivity between AWS and both source and target databases
Step 1: Set Up AWS DMS
Create DMS Replication Instance
Configure Security Groups
Ensure your replication instance can connect to:- Source PostgreSQL database (port 5432)
- PlanetScale for Postgres (port 5432)
- Internet for PlanetScale connectivity
Step 2: Create Source Endpoint
Configure PostgreSQL source endpoint:
1
In DMS Console, go to “Endpoints” > “Create endpoint”
2
Configure source endpoint:
Advanced settings for PostgreSQL:
Step 3: Create Target Endpoint
Configure PlanetScale for Postgres target endpoint:
1
Create target endpoint with PlanetScale connection details:
SSL Configuration:
Step 4: Test Endpoints
1
Select your source endpoint and click “Test connection”
2
Select your target endpoint and click “Test connection”
3
Ensure both tests pass before proceeding
Step 5: Create Migration Task
Configure the migration task:
1
Go to “Database migration tasks” > “Create task”
2
Configure task settings:
Task Settings
Step 6: Configure Table Mappings
Basic table mapping (migrate all tables):
Advanced table mapping with transformations:
Step 7: Start Migration Task
1
Review all task configurations
2
Click “Create task” to start the migration
3
Monitor the task status in the DMS console
Step 8: Monitor Migration Progress
Key metrics to monitor:
- Full load progress: Percentage of tables loaded
- CDC lag: Latency between source and target
- Error count: Any migration errors
- Throughput: Records per second
Using CloudWatch:
Set up CloudWatch alarms for:- High CDC latency
- Migration errors
- Task failures
Step 9: Verify Data Migration
Check table counts and data integrity:
Validate specific data:
Step 10: Prepare for Cutover
Monitor CDC lag:
Ensure CDC latency is minimal (under 5 seconds) before cutover:Test application connectivity:
- Create a read-only connection to PlanetScale for Postgres
- Test critical application queries
- Verify performance is acceptable
Step 11: Perform Cutover
When ready to switch to PlanetScale for Postgres:1
Stop application writes to source database
2
Wait for CDC to catch up (monitor lag in DMS console)
3
Verify final data consistency
4
Update application connection strings to point to PlanetScale
5
Start application with new connections
6
Stop DMS task once satisfied with cutover
Stop the migration task:
Step 12: Cleanup
After successful cutover:1
Delete DMS task
2
Delete replication instance (to stop charges)
3
Remove source and target endpoints
4
Clean up security groups if created specifically for migration
Troubleshooting
Common Issues:
Connectivity problems:- Check security groups and network ACLs
- Verify endpoint configurations
- Test network connectivity from replication instance
- Increase replication instance size
- Adjust parallel load settings
- Monitor source database performance
- Review DMS data type mapping
- Use transformation rules for custom mappings
Performance Optimization:
- Parallel loading: Increase
MaxFullLoadSubTasks
- Batch apply: Enable for better target performance
- Memory allocation: Increase replication instance size
- Network optimization: Use placement groups for better network performance
Cost Optimization
- Instance sizing: Start with smaller instances and scale up if needed
- Multi-AZ: Disable for dev/test migrations
- Task lifecycle: Delete resources immediately after successful migration
- Data transfer: Consider AWS region placement to minimize transfer costs
Schema Considerations
Before migration, review:Next Steps
After successful migration:1
Set up monitoring and alerting for PlanetScale for Postgres
2
Optimize application performance with the new database
3
Plan for ongoing maintenance and backup strategies
4
Consider implementing additional PlanetScale features