Cloud Migration Strategy and Execution Questions
Planning and executing a move to the cloud: the migration strategies (rehost, replatform, refactor, repurchase, retire, retain), legacy assessment, dependency mapping, cutover planning, and rollback. Covers phased migration roadmaps, workload modernization, risk management during cutover, and validating success post-migration. The end-to-end migration lifecycle, not steady-state operations.
Compare four database migration techniques: logical dump-and-restore, physical copy (snapshot/replication), continuous replication with CDC (e.g., DMS), and backup/restore. For each technique list expected downtime, data-loss risk, complexity level, and a best-case use scenario.
Sample Answer
Direct answer: Logical dump-and-restore, physical copy (snapshot/replication), continuous replication with change-data-capture (CDC), and backup/restore trade off downtime and complexity in a predictable pattern: the simplest methods have the most downtime, and downtime drops as the method gets closer to continuous/near-real-time replication.
Structured elaboration
| Technique | Expected downtime | Data-loss risk | Complexity | Best-case use scenario |
|---|---|---|---|---|
Logical dump-and-restore (e.g., mysqldump/pg_dump then restore) | High (dump + restore time scales with data size) | Low if the dump completes cleanly before cutover | Low | Small-to-medium databases, generous maintenance window, and/or heterogeneous migrations where the dump format needs translation anyway |
| Physical copy (snapshot/replication at the storage layer) | Medium (snapshot is fast, but a final consistency sync still takes time) | Low, if the snapshot is application-consistent -- meaning the database was cleanly paused/flushed before the snapshot, so it restarts without any recovery step -- rather than merely crash-consistent, where the snapshot was taken without warning it, like a sudden power loss, so it may need the database's own crash-recovery process on restart | Medium (needs storage-layer tooling and often database-quiesce coordination) | Large homogeneous databases where a brief pause for a consistent snapshot is tolerable |
| Continuous replication with CDC | Low (near-zero, cutover is just draining replication lag) | Very low if lag is monitored and cutover waits for lag to reach zero | High (requires CDC infrastructure, ongoing monitoring, conflict handling) | Business-critical databases with strict downtime SLAs |
| Backup/restore (full backup, transfer, restore) | Highest (backup + transfer + restore, often the slowest of the four for large data) | Low, but only as current as the last backup taken before restore starts | Lowest | Non-critical or already-scheduled-downtime workloads, or as a FALLBACK/DR path alongside a primary method |
Worked example. A 2TB transactional database with a 2-hour maintenance window comfortably fits a physical snapshot approach (typically minutes to snapshot, then a short consistency sync); the same database with a 10-minute window needs CDC-based continuous replication instead, since even an efficient snapshot-and-sync approach at that data size is unlikely to reliably close within 10 minutes.
Trade-offs & pitfalls. Backup/restore is often chosen by default because it's the most familiar tooling, even when the downtime it implies doesn't actually fit the stated SLA; the table above should be read as a downtime-tolerance-driven decision, not a familiarity-driven one.
You're migrating an OLTP workload using AWS DMS. Explain important DMS configuration choices including full load vs CDC, LOB handling, table mapping, tuning for throughput (workers/parallelism), IAM permissions, and monitoring metrics that indicate replication health and latency.
Sample Answer
Direct answer: For an OLTP (online transaction processing) workload migrating via AWS DMS (Database Migration Service), the configuration choices that matter most are full-load-vs-change-data-capture (CDC) mode selection, correct LOB (large object) handling, deliberate table mapping (not defaults), tuned parallelism, scoped IAM permissions, and monitoring specifically for replication latency and task health, since a misconfiguration in any of these can silently produce an incomplete or lagging target rather than an obvious failure.
Structured elaboration. Full load vs CDC: "full load" alone copies a point-in-time snapshot with no ongoing sync (fine only if downtime for the copy duration is acceptable); "full load + CDC" does the initial snapshot AND then continuously replicates ongoing changes (the standard choice for a near-zero-downtime OLTP migration); "CDC only" (no initial full load) is used when the target already has the historical data via another means and only ongoing changes need replicating from a defined starting point. LOB handling: DMS has different strategies for large object columns (full LOB mode transfers LOBs completely but is slower; limited LOB mode caps LOB size and truncates anything larger, which is FAST but can silently truncate data if the configured limit is set too low for the actual data); for an OLTP workload with LOB columns, this needs deliberate sizing based on actual observed LOB sizes in the source, not a default guess. Table mapping: explicit include/exclude rules and any needed transformation rules (renaming, filtering) should be deliberately configured rather than relying on a broad "migrate everything" default, which risks pulling in tables that shouldn't be in scope or missing transformation needs for heterogeneous target schemas. Tuning for throughput (workers/parallelism): DMS parallelism settings (number of tables loaded concurrently, parallel load threads per table for large tables) need tuning against both the source database's capacity to handle concurrent read load and the target's capacity to absorb concurrent writes, since over-aggressive parallelism can overload either side. IAM permissions: DMS needs specific source and target permissions (read access with sufficient privilege to read change data on the source, write access on the target); scope these to exactly what's needed rather than granting broad database-admin-level access to the DMS service role. Monitoring metrics indicating replication health/latency: DMS exposes metrics like CDC latency (source and target), throughput, and task status; specifically watch for CDC latency trending upward (an early warning that the replication task can't keep pace with source write volume) rather than only checking for outright task failures, since a slowly-falling-behind task is a more common and more silently dangerous failure mode than a hard crash.
Worked example. For an OLTP database with a moderate-size LOB column (e.g., document attachments averaging a few MB but occasionally larger): configure full LOB mode if data integrity for those larger attachments matters (accepting slower throughput) rather than limited LOB mode with a size cap set from a guess; explicitly map and validate the table list rather than trusting a default "migrate the whole schema" setting, especially if the target uses a different schema organization; monitor CDC latency continuously through the replication period, treating a sustained upward trend as an actionable signal to investigate (source write-volume spike, target capacity constraint) well before it becomes a blocking issue at cutover time.
Trade-offs & pitfalls. Using limited LOB mode with a default or guessed size cap is a common way this kind of migration silently truncates data: the migration APPEARS to succeed (no errors, task shows complete) while some large-object values are quietly cut off, which is only discovered later when someone notices a corrupted or incomplete document, well after the DMS task reported success.
Plan a migration of Lyft's analytics warehouse from Redshift to Snowflake with minimal downtime. Requirements: ensure correctness of reporting tables, keep streaming ingestion active during migration, provide validation queries, and detail a cutover and rollback plan. Discuss CDC or dual-write approaches and data validation strategies.
Sample Answer
Direct answer: Migrating an analytics warehouse from Redshift to Snowflake while keeping streaming ingestion active requires running both warehouses in parallel with change-data-capture (CDC) / dual-write into Snowflake, validating query-result parity on the reporting tables before any cutover, and treating streaming ingestion as its own migration sub-problem (repoint the stream's target once, not incrementally).
Structured elaboration. Correctness of reporting tables: identify the specific tables that feed reporting (usually a small, well-known subset of the full warehouse) and prioritize validating THOSE first and most rigorously, since reporting correctness is the stated hard requirement, not full-warehouse parity from day one. Keeping streaming ingestion active during migration: rather than pausing the stream, fan it out to write to BOTH Redshift and Snowflake during the transition (dual-write at the ingestion layer, which is more tractable here than dual-write at the application layer because there's a single, well-understood ingestion point rather than many application write paths), or alternatively replicate Redshift's ingested data into Snowflake via CDC/ETL if the ingestion pipeline can't easily be duplicated. Validation queries: write parity-check queries that run the SAME aggregation logic against both warehouses and diff the results (row counts alone aren't sufficient for a data-warehouse migration; the actual reported NUMBERS have to match, since a schema or type-conversion bug can silently shift an aggregate while preserving row counts). Cutover and rollback plan: once dual-write/CDC has run long enough that parity checks are consistently clean across multiple reporting cycles (not just once), cut reporting queries over to Snowflake first (lower risk, easy to revert by pointing dashboards back at Redshift), THEN cut the ingestion stream over to Snowflake-only once reporting has been stable on the new warehouse for a defined bake period. CDC or dual-write approaches: dual-write at ingestion is simpler to validate (both warehouses see the same events at write time) but doubles ingestion infrastructure cost during the transition; CDC/ETL replication from Redshift to Snowflake avoids touching the ingestion pipeline but adds replication lag that has to be accounted for in parity checks.
Worked example. Weeks 1-2: stand up Snowflake, backfill historical data, validate schema/type conversions against a sample. Weeks 3-6: dual-write new streaming events to both warehouses, run daily parity checks on the reporting-critical tables (aggregate revenue, active-user counts, etc.), fixing any type-conversion or timezone-handling discrepancies found (a common source of subtle mismatches between warehouse engines). Week 7: cut reporting dashboards over to Snowflake, keep Redshift as the ingestion target of record for one more week as a safety net. Week 8: cut ingestion to Snowflake-only, decommission Redshift after a further bake period.
Trade-offs & pitfalls. The most common failure mode in a cross-engine warehouse migration is validating SCHEMA correctness (columns match, types are compatible) but not validating COMPUTATIONAL correctness (does SUM() over a decimal column produce the identical value given the two engines' different rounding/precision behavior); the parity checks above are deliberately built around comparing actual reported numbers, not just structural equivalence.
You are migrating a legacy on-prem data warehouse to Snowflake. Produce a migration plan covering data transfer, schema translation, materialized view and index equivalents, re-optimizing queries, security roles and dynamic data masking, validation strategies for parity, and a cutover plan minimizing downtime.
Sample Answer
Direct answer: A Snowflake-target data-warehouse migration needs three technical translation passes beyond generic data transfer: schema/data-type translation, materialized-view and index equivalence (Snowflake has no traditional indexes; its performance model relies on micro-partitioning and clustering keys instead), and query re-optimization, plus a security-role redesign since Snowflake's RBAC and dynamic-data-masking model differs meaningfully from most legacy on-prem warehouses.
Structured elaboration. Data transfer: bulk-load historical data (commonly via cloud storage staging: land files in object storage, then COPY INTO Snowflake tables) plus an ongoing sync mechanism for data still landing on the legacy warehouse during the transition. Schema translation: map source data types to Snowflake equivalents (most map cleanly, but proprietary types or vendor-specific extensions need explicit handling), and validate any stored procedures/views for syntax differences. Materialized view and index equivalents: Snowflake doesn't use traditional B-tree indexes; the closest equivalents are clustering keys (which influence how micro-partitions are organized for a given table's common query patterns) and materialized views (which Snowflake does support, functioning similarly to other warehouses but with different maintenance/refresh cost characteristics); this mapping has to be done deliberately per table based on actual query patterns, not assumed to be automatic. Re-optimizing queries: queries tuned for the old warehouse's optimizer (index hints, specific join orders) often need re-tuning for Snowflake's own cost-based optimizer and its columnar, micro-partitioned storage model; the biggest win is usually ensuring clustering keys align with the most common filter predicates in reporting queries. Security roles and dynamic data masking: Snowflake's RBAC model (roles with hierarchical grants) and native dynamic-data-masking policies (applying a masking function to a column based on the querying role) typically require a genuine redesign rather than a literal translation of the source system's role/permission model, since the underlying primitives differ. Validation strategies for parity: compare query results (not just schema) between source and target for the reporting-critical query set, and separately validate that masking/security policies produce the CORRECT restricted view for each role class, not just that unrestricted queries match. Cutover plan minimizing downtime: run both warehouses in parallel (similar pattern to a cross-provider migration), cut over reporting once parity and security-policy validation both pass.
Worked example. A common oversight: a legacy warehouse's row-level security implemented via views that filter by a tenant ID column gets naively translated into a Snowflake row-access policy, but the policy's underlying predicate logic (which role sees which tenant's rows) needs to be independently re-tested against every role class, not assumed correct just because the SQL compiled without error.
Trade-offs & pitfalls. Treating clustering keys as a set-once-and-forget migration step is a common mistake: unlike traditional indexes, clustering key effectiveness depends on data's natural insertion order and can degrade over time as new data lands, requiring periodic re-clustering (automatic or manual) that the migration plan should account for as an ongoing operational cost, not a one-time setup task.
Design a migration plan for a globally distributed, sharded relational database where shards are placed in different regions and cross-shard transactions exist. Your design must preserve ACID semantics and global ordering for users. Describe replication strategies, transactional guarantees to preserve during migration, conflict resolution, and cutover approach to avoid data loss or inconsistency.
Sample Answer
Direct answer: For a globally-sharded relational database with cross-shard transactions, migrate shard-by-shard using per-shard replication while preserving the existing sharding/consensus scheme (don't try to also change the sharding topology in the same migration), and gate cutover of cross-shard-transaction-bearing shards on demonstrating the distributed transaction protocol behaves identically end-to-end on the new infrastructure.
Structured elaboration. Replication strategy: replicate each shard independently using the same technique used for a single-region database migration (change-data-capture (CDC) / logical replication per shard), but coordinate the CUTOVER across shards rather than each shard's replication setup, since replication itself can run shard-by-shard on independent timelines. Transactional guarantees to preserve: if the system relies on a 2-phase-commit (a coordinator asks every participating shard to confirm it CAN commit -- the 'prepare' phase -- before telling all of them to actually commit, so a cross-shard transfer can't be double-counted or half-applied) or a distributed consensus protocol (e.g., Paxos/Raft-based coordination -- different algorithms solving the same underlying problem, getting a set of nodes to agree on one value or ordering, even if some of them fail) for cross-shard transactions and global ordering, that coordination layer needs to keep working correctly THROUGHOUT the migration, including during any period where some shards have cut over and others haven't; the safest approach is to migrate all shards that participate in any given cross-shard transaction TOGETHER in one wave, rather than spreading cross-shard-transaction partners across different migration waves, which would require the coordination protocol to span old and new infrastructure simultaneously: the prepare-phase confirmation from a shard on the new infrastructure would need to reliably reach a coordinator that may still be running against the old infrastructure (or vice versa), and any confirmation that gets lost or delayed across that boundary leaves the transaction stuck half-committed -- a much harder and riskier problem than keeping the whole protocol on one side of the migration at a time. Conflict resolution: during the replication (pre-cutover) period, no conflict resolution is needed since the new shards are read-only replicas; the risk window is narrow (the final cutover moment), so the main protection is pausing writes across ALL shards being cut over simultaneously, not resolving conflicts after the fact. Cutover approach to avoid data loss/inconsistency: pause writes globally (or at minimum, across every shard involved in any cross-shard transaction being cut over together) briefly, drain replication lag on every shard in the wave, verify parity per shard AND verify no cross-shard transaction was left in a partially-committed state at the pause moment, then repoint and resume.
Worked example. A globally-sharded ledger system with 4 shards, where transactions between users on shard A and shard B require 2-phase commit: migrate shard A and shard B TOGETHER in the same cutover wave (never split transaction partners across waves), even if shards C and D (which don't participate in A-B transactions) migrate independently on their own schedule. During the A+B cutover: pause new cross-shard transactions specifically involving A or B, let any in-flight 2PC transactions either commit or abort cleanly (never leave one in the prepare phase across the pause), drain replication, verify, then resume.
Trade-offs & pitfalls. The single biggest risk is treating shards as independently migratable units when cross-shard transactions exist: migrating shard A this week and shard B next month looks parallelizable and schedule-friendly, but leaves the distributed transaction coordinator spanning old and new infrastructure for the gap, which is a much harder failure mode to reason about than a same-wave joint cutover.
Unlock Full Question Bank
Get access to all 14 Cloud Migration Strategy and Execution interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.