How would you migrate an on-premises MySQL database to Amazon RDS with minimal downtime?

AdvancedScenarioMySQL
Answer

Short answer

Load an initial copy into RDS, keep it continuously in sync with the on-prem source using binlog replication (RDS as a replica of the external source) or AWS DMS with CDC, test the application against RDS, then do a short cutover: stop writes, wait for zero lag, repoint the app, done.

Steps

  1. Prepare RDS — same major version, parameter group (charset, timezone, sql_mode), security groups, Multi-AZ.
  2. Initial load — mysqldump --single-transaction --source-data=2 (or Percona XtraBackup → S3 → restore) to capture data plus binlog position.
  3. Ongoing sync
    • Native: CALL mysql.rds_set_external_source(...) then CALL mysql.rds_start_replication; (needs network path via VPN/Direct Connect).
    • Or AWS DMS full load + CDC.
  4. Validate — row counts, checksums (pt-table-checksum or DMS validation), app smoke tests on a read-only copy.
  5. Cutover (minutes) — put the app in maintenance/read-only, confirm lag = 0, stop replication, point the app's connection string/DNS to RDS, resume.
  6. Rollback plan — keep on-prem intact (or reverse replication) until confident.

What to say in the interview

"Initial load with a consistent dump or XtraBackup, then continuous replication from on-prem into RDS via external binlog replication or DMS CDC. After validation, a short cutover — freeze writes, wait for zero lag, switch the endpoint — with on-prem kept as rollback."

All Databases (MySQL, PostgreSQL, MongoDB) questions Roadmap: MySQL basics

More on MySQL