How would you migrate a large production database to a managed cloud database with near-zero downtime?
What the interviewer wants to hear
- Initial full load plus change data capture to keep target in sync
- Validate data and schema compatibility before cutover
- Plan the cutover: freeze writes briefly, wait for lag zero, switch connections
- Use DNS or config switch and keep a rollback path with reverse replication
- Test performance, monitor replication lag, rehearse the cutover
Model answer
The key idea is to keep the old and new databases in sync while the application is still live. First I check compatibility, such as engine versions, extensions and character sets, and create the target schema. Then I do a full load using native tools like pg_dump or a snapshot, or AWS DMS, followed by change data capture through native logical replication or DMS so ongoing writes keep flowing to the target. I validate row counts and checksums and run load tests against the new database. For cutover, I rehearse in staging first. In production, I briefly stop writes or put the app in read-only mode, wait until replication lag is zero, run final validation, and switch the connection string through config or a DNS name. Before switching, I set up reverse replication if possible, so rollback is fast. Total write downtime can be a few minutes or less.
Can you answer it under time pressure?
Take a timed hard round and get scored on every answer.
More hard Cloud Engineer questions
- Design a multi-region disaster recovery setup for a payments API with an RPO of under 1 minute and an RTO of 15 minutes. What trade-offs do you consider?
- How would you design a multi-account cloud landing zone for a company with 20 product teams?
- Leadership asks you to reduce the cloud bill by 30 percent without hurting reliability. How do you approach it?
- A company needs reliable connectivity between its data center and the cloud. Compare site-to-site VPN and a dedicated connection like AWS Direct Connect, and describe a resilient design.
- Design a shared Kubernetes platform used by 30 product teams. How do you handle isolation, security, cost and upgrades?
- You find out that long-lived AWS access keys were pushed to a public GitHub repository an hour ago. How do you respond?
- Design observability and alerting for a customer-facing API so on-call gets paged for real problems but not for noise.
- Design an event-driven order processing system on a public cloud that must handle traffic spikes and never lose or double-charge an order.
- Your company has hundreds of Terraform configurations owned by many teams. How do you structure modules, state and governance so it scales safely?