This page requires JavaScript to display.
M
Unpacking...
← Cloud Platforms

AWS Migration Use Case 1

A complete on-premises to AWS migration: assessment and the 7 Rs, landing zone, hybrid networking, EC2, serverless, DMS database migration, the data platform, security, CI/CD, cutover and multi-region disaster recovery, with architecture diagrams.

29 min read
Contents
1. The Scenario: Closing a Data Centre in 12 Months 2. The Target Architecture 3. The Migration Journey, Phase by Phase 4. Networking and Hybrid Connectivity 5. Compute and Cost (EC2) 6. Applications: Serverless API and the Web Tier 7. Databases and the DMS Migration 8. Data Engineering Platform 9. CI/CD: Every Change Through a Pipeline 10. Security and Encryption 11. Monitoring and Audit 12. Cutover and Rollback 13. Disaster Recovery and Business Continuity 14. Interview-Ready Summary and Questions 15. Glossary

1. The Scenario: Closing a Data Centre in 12 Months

Acme (a fictional company) runs everything in one data centre that must be closed within 12 months: web servers, a REST API, Oracle and SQL Server databases, a 10 TB Oracle data warehouse, a 60 TB Hadoop cluster, 25 TB of file shares, clickstream collectors and a licensed risk engine. This card walks through the complete migration to AWS: assessment, landing zone, every migration path, the data platform, security, monitoring, CI/CD, cutover and disaster recovery.

On-premises systemSizeDecision (7 Rs)Target on AWS
Customer Portal (Tomcat web servers)2 serversRehostEC2 Auto Scaling behind an ALB
Accounts API (Spring Boot, REST/JSON)1 serverRefactorLambda + API Gateway
Core accounts database (Oracle 19c)3.5 TBReplatformAmazon RDS for Oracle, migrated with DMS
Payments database (SQL Server 2016)1.2 TBReplatformRDS for SQL Server, migrated with DMS
HR portal (vendor app + MySQL)small (80 GB)RehostMGN for the app server + RDS MySQL
Reporting data warehouse (Oracle)10 TBReplatformAmazon Redshift (DMS → S3 → COPY)
Hadoop / Spark 2.4 cluster60 TB HDFSReplatformAmazon EMR + S3 + Glue Data Catalog
File shares (NFS / SMB)25 TBReplatformS3 via DataSync (or Snowball Edge)
Clickstream collectors (Flume)—RefactorKinesis Data Streams + Firehose
Licensed risk engine (per-core licence)1 serverRehostEC2 Dedicated Host (bring your own licence)
Old fax serveralmost unusedRetireSwitched off

Constraints that shape every decision

ConstraintDesign consequence
Data must stay in IndiaPrimary region Mumbai (ap-south-1), DR region Hyderabad (ap-south-2); no service or replica outside India
Minimal downtime for databasesDMS full load + change data capture (CDC); cutover window of minutes, not days
Everything encryptedKMS keys per data class, CloudHSM for the most sensitive keys, TLS everywhere, IPsec on the VPN
Every change through a pipelineTerraform + SAM + CodePipeline; no console changes
A tested DR planRecovery targets per tier, scripted failover, daily readiness checks, quarterly drills

Everything in this use case uses placeholders: account IDs, IP ranges, domains and the company name are examples. The code it refers to is written to be read and learned from, not deployed as-is.

2. The Target Architecture

The diagram shows the end state, read left to right: the on-premises data centre, the hybrid network links, the primary AWS region with its VPC and regional services, and the DR region on the right. Security, monitoring and DR summaries run along the bottom.

Target architecture: on-premises data centre connected by Direct Connect and VPN to a Transit Gateway in ap-south-1, a three-tier VPC with EC2, Lambda, EMR, RDS, Redshift, OpenSearch, DMS and CloudHSM, regional services S3, Glue, Athena, Kinesis and DynamoDB, and a DR region ap-south-2 kept current by replicas, backups and replicationOpen full size ↗

Solid arrows are traffic and data flow; dashed red arrows are replication to the DR region.

#LayerWhat it containsWhy
1On-premisesExisting systems, plus agents: MGN (server replication), DataSync (files), DRS (DR after rehost), Discovery (inventory)The data centre keeps running until each wave is cut over
2Hybrid connectivityDirect Connect (1 Gbps, primary), Site-to-Site VPN (backup), DX Gateway (reaches both regions)Predictable bandwidth for TBs of migration traffic, with an encrypted fallback
3Network hubTransit Gateway with route tablesOne hub for VPCs, VPN and DX instead of a mesh of peerings
4VPC (3 AZs)Public, app and data subnets in each Availability Zone; VPC endpoints; flow logsSurvive the loss of a data centre; keep data tiers off the internet
5Regional servicesS3 data lake, Glue, Athena, Kinesis + Firehose, DynamoDBServerless, managed services that live outside the VPC and are reached privately through endpoints
6EdgeRoute 53, WAF, API Gateway, ALB (optional CloudFront)All user traffic enters over HTTPS through a firewall
7DR regionSmaller copy kept current by replicas, backups and replicationBusiness continuity if the whole primary region fails
8Around everythingIAM, KMS, CloudHSM, CloudWatch, CloudTrail, Config, GuardDuty, CodePipelineSecurity, observability and change control for every component

3. The Migration Journey, Phase by Phase

AWS migrations follow three phases, Assess → Mobilize → Migrate & Modernize, followed by operating and optimising. Skipping Assess is the most common cause of failed migrations: undiscovered dependencies break applications at cutover.

Phase 1: Assess

StrategyMeaningExample in this projectWhen it fits
RetireSwitch offFax serverUnused or duplicated systems; typically 10–20% of a portfolio
RetainKeep on-premises for now—Not ready, recently upgraded, or regulatory blockers
RehostLift and shift, no code change (MGN)Web servers, HR app, risk engineFastest path; optimise later
RelocateMove a VMware estate as-is—Large VMware estates (VMware Cloud on AWS)
RepurchaseReplace with SaaS—Commodity functions: email, CRM, HR
ReplatformSmall changes to use managed servicesOracle → RDS, Hadoop → EMR, files → S3Remove undifferentiated operations work
RefactorRe-architect cloud-nativeREST API → Lambda, Flume → KinesisWhere scalability, agility or cost justify the effort

Phase 2: Mobilize (build the landing zone)

A landing zone is the secure, well-architected base (accounts, network, identity, logging, guardrails) that workloads land on. Everything here is Terraform, applied by the pipeline:

StepWhatFile
1State bucket and lock table; providers for both regionsmain.tf
2KMS keys, CloudHSM, IAM roles, Secrets Manager, WAF, ACMsecurity.tf
3VPCs in both regions from one reusable modulemodules/network/
4Transit Gateways, VPN, Direct Connect, inter-region peering, security groupsnetwork.tf
5CloudTrail, CloudWatch, Config, GuardDuty, SNSmonitoring.tf
6CI/CD pipelinecicd.tf

Exit criteria before any workload moves: connectivity tested from the data centre, logging on, Config guardrails green, and the pipeline deploying to a dev account.

Phase 3: Migrate and modernize, in waves

WaveApplicationsToolsWhy this order
0Retire the fax server—Quick win; shrinks the estate
1Customer Portal web tier, HR portalMGN (rehost), CodeDeployLow risk; proves network, security and runbook
2Oracle core + SQL Server paymentsDMS full load + CDC, cutover runbookDatabases before the API that depends on them
3Accounts API → serverlessSAM, API Gateway, Lambda, RDS ProxyRefactor once the database is already in AWS
4Data platform: Hadoop, DW, files, clickstreamEMR, Glue, Redshift, DataSync, KinesisLargest volume; benefits from a stable foundation
5Risk engine on a Dedicated Host + DR for rehosted serversMGN, DRSLicence-sensitive; done after licensing is agreed

Phase 4: Operate and optimise

Right-size instances with CloudWatch data, buy Savings Plans for the steady baseline, run DR drills every quarter, review Config and GuardDuty findings, and finally close the data centre.

4. Networking and Hybrid Connectivity

Network and landing zone service-level view: on-premises systems, hybrid connectivity with Direct Connect, VPN, Transit Gateway and DX Gateway, the Mumbai VPC with public, app and data subnets, VPC endpoints and regional services, and the Hyderabad DR regionOpen full size ↗

The VPC: three tiers in three Availability Zones

Subnet tierContainsInternet accessWhy
PublicALB, NAT gatewaysYes, through the Internet GatewayOnly the components that must face the internet
AppEC2, Lambda (VPC-attached), EMROutbound only, through NATServers can download patches but cannot be reached from outside
DataRDS, Redshift, DMS, OpenSearch, CloudHSMNoneEven a compromised server cannot exfiltrate directly to the internet

Plan IP ranges first. AWS (10.20.0.0/16 primary, 10.30.0.0/16 DR) must not overlap the data centre (172.16.0.0/12). Overlapping ranges make routing over VPN or Direct Connect impossible, and re-addressing later is very painful.

Direct Connect vs Site-to-Site VPN

Direct Connect (DX)Site-to-Site VPN
PathPrivate fibre to an AWS Direct Connect locationEncrypted tunnel over the public internet
Bandwidth / latency1–100 Gbps, predictableUp to about 1.25 Gbps per tunnel, variable
EncryptionNot by default: use TLS, MACsec (on supported ports), or a VPN over DXIPsec (AES-256-GCM, IKEv2)
Lead timeWeeks (physical cross-connect)Hours
Role herePrimary path for migration traffic (DMS, MGN, DataSync)Backup path and day-one connectivity

How long will the data take to move?

A quick calculation decides between network transfer and Snowball. At 1 Gbps with realistic 80% utilisation, 25 TB of file shares takes about 25×8,000 / (1×0.8) ≈ 250,000 seconds, roughly 3 days; the 60 TB HDFS and 10 TB DW history add about 10 more days, competing with DMS and MGN replication. That is why bulk history can go by Snowball Edge while DataSync handles the changing delta over the network.

Say this in the interview

"I build a three-tier VPC across three AZs (public for the ALB and NAT, private app subnets, and data subnets with no internet route), with VPC endpoints and flow logs. On-premises connects through Direct Connect as the primary path and a Site-to-Site VPN as the encrypted backup, both on a Transit Gateway with BGP preferring DX. A DX Gateway and Transit Gateway peering extend connectivity to the DR region. I plan non-overlapping CIDRs before anything else."

5. Compute and Cost (EC2)

Purchase optionUse it forIn this project
On-DemandSteady or unknown load, short-livedWeb tier baseline (2 instances), HR app
Spot (up to about 90% cheaper, can be reclaimed with 2 minutes' notice)Fault-tolerant, interruptible workWeb tier burst capacity, EMR task nodes, CI builds
Savings Plans / Reserved InstancesThe always-on baseline, 1- or 3-year commitmentCovers the On-Demand baseline once usage is known
Dedicated InstanceHardware not shared with other customers (compliance)Example in the CLI scripts
Dedicated HostA whole physical server: visibility of sockets and cores for per-core licences (BYOL)Risk engine

How the web tier is built

resource "aws_autoscaling_group" "web" {
  name                = "acme-web"
  min_size            = 2
  max_size            = 12
  vpc_zone_identifier = module.network.app_subnet_ids  # three AZs
  target_group_arns   = [aws_lb_target_group.web.arn]
  health_check_type   = "ELB"
  capacity_rebalance  = true

  mixed_instances_policy {
    instances_distribution {
      on_demand_base_capacity                  = 2  # always On-Demand
      on_demand_percentage_above_base_capacity = 25  # then 25% On-Demand / 75% Spot
      spot_allocation_strategy                 = "price-capacity-optimized"
    }
    launch_template {
      launch_template_specification {
        launch_template_id = aws_launch_template.web.id
        version            = "$Latest"
      }
      override { instance_type = "m6i.large" }
      override { instance_type = "m6a.large" }
      override { instance_type = "m5.large" }
      override { instance_type = "m7i.large" }
    }
  }
}

Illustrative Terraform following the AWS provider's syntax; not applied here.

Say this in the interview

"I match purchase options to workload shape: On-Demand for the baseline, covered by Savings Plans once usage is stable; Spot for interruptible capacity such as web burst, EMR task nodes and CI, spread across several instance types with capacity rebalancing; and Dedicated Hosts for per-core licensed software. Instances use IMDSv2, encrypted gp3 volumes and SSM instead of SSH."

6. Applications: Serverless API and the Web Tier

Application architecture: users through Route 53, WAF, ACM and ALB to an EC2 Auto Scaling web tier, and through API Gateway to Lambda handlers that read DynamoDB, write RDS MySQL through RDS Proxy and publish to Kinesis, with a stream processor Lambda updating running balancesOpen full size ↗

The serverless Accounts API

Client -HTTPS-> WAF -> API Gateway (REST, API key, JSON schema validation, throttling)
                          |
              +-----------+------------------------+
              v           v                        v
   GET /accounts/{id}   POST /transactions       (Kinesis) -> stream processor Lambda
   DynamoDB summary     1 idempotency key (DynamoDB)                 |
   (single-digit ms)    2 insert in RDS MySQL via RDS Proxy          v
                        3 publish event to Kinesis              DynamoDB running balances
ConcernHow it is handledWhy it matters
Bad inputAPI Gateway validates the JSON body against a model before Lambda runsInvalid requests cost nothing and never reach code
Double posting on retriesIdempotency-Key header + DynamoDB conditional write + unique key in MySQLA client retrying after a timeout must not move money twice
Database connection stormsRDS Proxy pools connections; Lambda concurrency capped at 100Thousands of concurrent Lambdas would otherwise exhaust database connections
Database passwordNone: Lambda uses an IAM authentication token; TLS enforcedNo long-lived secret to leak
Safe releasesCanary deployment: 10% of traffic for 5 minutes, automatic rollback on errorsA bad release affects few users, briefly
Bad stream recordsPartial batch failure responses, bisect on error, SQS dead-letter queueOne poison record cannot block the stream
TracingAWS X-Ray end to endFind which hop is slow

Idempotency: the pattern behind "no double posting"

import boto3
from botocore.exceptions import ClientError

table = boto3.resource("dynamodb").Table("idempotency-keys")

def handle_post_transaction(event, context):
    key = event["headers"]["Idempotency-Key"]
    try:
        table.put_item(  # succeeds only for a NEW key
            Item={"key": key, "status": "IN_PROGRESS", "ttl": ttl_in_24h()},
            ConditionExpression="attribute_not_exists(#k)",
            ExpressionAttributeNames={"#k": "key"},
        )
    except ClientError as e:
        if e.response["Error"]["Code"] == "ConditionalCheckFailedException":
            return previous_response(key)  # a retry: return the first result, do nothing
        raise
    result = insert_transaction_via_rds_proxy(event)  # unique constraint in MySQL is the second guard
    publish_to_kinesis(result)
    save_response(key, result)
    return result

Illustrative handler; helper functions such as insert_transaction_via_rds_proxy are placeholders.

The web tier on EC2

The rehosted portal is made Auto Scaling-friendly: stateless (no sessions on disk), configuration from SSM Parameter Store, a /health endpoint and JSON logs. CodeDeploy updates one instance at a time, removes it from the ALB while updating, checks /health, and rolls back automatically if the ALB 5xx alarm fires.

Say this in the interview

"The Accounts API was refactored to API Gateway and Lambda: schema validation at the gateway, idempotency keys with DynamoDB conditional writes and a unique key in MySQL so retries never double-post, RDS Proxy with IAM authentication to protect the database, canary deployments with automatic rollback, and Kinesis plus a stream processor for derived balances with partial batch failures and a DLQ."

7. Databases and the DMS Migration

Database migration and data engineering flows: Oracle, SQL Server, the Oracle data warehouse and file shares migrating through DMS, SCT, DataSync, Snowball and Kinesis to RDS, S3 and Redshift, the four-step low-downtime cutover, and the S3, Glue, EMR, Redshift, Athena, DynamoDB and OpenSearch analytics platformOpen full size ↗

Target databases

All RDS instances are Multi-AZ (synchronous standby with automatic failover), encrypted with KMS, TLS required, with passwords generated and rotated through Secrets Manager, 14 days of point-in-time recovery, Performance Insights, Enhanced Monitoring and deletion protection. MySQL also has a cross-region read replica in the DR region.

How DMS moves a live database with minimal downtime

 day 1 -- full load (copy all tables) -- CDC: keep applying every change --+
                                                                            |
 applications still use on-premises the whole time                         v
                                                  cutover window (minutes):
                                                  freeze -> drain -> validate -> switch
StepWhat happensCommand / file
1. Source prerequisitesDBA enables archive logging and supplemental logging (Oracle) or MS-CDC / MS-Replication (SQL Server), and creates a migration user—
2. Schema conversionOnly when engines differ (Oracle DW → Redshift): AWS SCT or DMS Schema Conversion—
3. Connectivity testDMS replication instance reaches both endpointsdms_runbook.sh test-connections
4. Full load + CDCCopy all tables in parallel while capturing ongoing changesdms_runbook.sh start core-accounts
5. MonitorPer-table progress, CDC latency, DMS validationdms_runbook.sh status core-accounts, dashboard
6. CutoverFreeze writes, wait for CDC latency ≈ 0, validate, stop task, switch connection stringsdms_runbook.sh cutover core-accounts
7. Independent validationRow counts, column sums, sampled row hashes per tablevalidate_migration.py

DMS settings that decide success

SettingWhy it matters
Parallel load (table and partition level)A 3.5 TB load finishes in hours, not days
LOB handling (limited vs full LOB mode)Full LOB mode is slow; limited mode with a correct max size is much faster but truncates bigger LOBs, so measure the largest LOB first
Batch apply for CDCApplies changes in batches to keep up with busy sources
Row-level validationDMS compares source and target rows and reports mismatches
Error policiesDecide whether a failed table stops the task or is logged and suspended

Validate independently: counts can hide errors

# validate_migration.py (idea): compare per table on source and target
checks = {
    "row_count": "SELECT COUNT(*) FROM {t}",
    "amount_sum": "SELECT SUM(amount) FROM {t}",  # catches changed values
    "sample_hash": "SELECT {hash}(id || '|' || amount || '|' || status) "
                   "FROM {t} WHERE MOD(id, 1000) = 7",  # deterministic sample of rows
}
for table in ["accounts", "transactions", "payments"]:
    for name, sql in checks.items():
        src, tgt = run(source_db, sql, table), run(target_db, sql, table)
        print(table, name, "OK" if src == tgt else f"MISMATCH {src} != {tgt}")

Illustrative outline; the hash function differs per engine (for example STANDARD_HASH in Oracle, HASHBYTES in SQL Server). Matching row counts with different sums is a real failure mode, which is why counts alone are never enough.

Other migration paths

WhatToolNotes
Servers (rehost)AWS Application Migration Service (MGN)Continuous block-level replication, test launches, then cutover
File shares (still changing)AWS DataSync, scheduled and verifiedIncremental transfers with checksum verification
Bulk exportsaws s3 sync with multipart and checksumsSimple and scriptable
Too much data for the networkAWS Snowball Edge, then DataSync for the deltaShip the bulk, sync the changes
Historical DW data into RedshiftDMS → S3 Parquet → COPY ... MANIFESTColumnar files loaded in parallel by Redshift slices
Say this in the interview

"For databases I use DMS full load plus CDC, so applications keep running on-premises while data copies, and the cutover is minutes: freeze writes, wait for CDC latency near zero, validate, switch connection strings. Prerequisites like Oracle supplemental logging and SQL Server MS-CDC come first, schema conversion only when engines differ, and I validate with counts, sums and sampled hashes, not counts alone."

8. Data Engineering Platform

BATCH                                              STREAMING
DMS (databases, DW history)                        Kinesis Data Streams (clickstream)
  -> S3 raw                                          -> Firehose -> S3 raw
  -> Glue crawler (Data Catalog)
  -> Glue ETL with job bookmarks -> S3 curated
  -> EMR Spark (PySpark + Scala) -> S3 analytics
  -> Redshift COPY / MERGE -> BI dashboards
                                                   SIDE PATHS
                                                   Athena: ad-hoc SQL on S3
                                                   Redshift Spectrum: reads S3 directly
                                                   DynamoDB: API state
                                                   OpenSearch: search
ComponentRole in the platformExpert notes
S3Data lake in zones: raw / curated / analyticsSSE-KMS with bucket keys, versioning, lifecycle tiers, TLS-only bucket policies
GlueData Catalog via crawlers, ETL jobs, nightly workflowJob bookmarks process only new data; the catalog replaces the Hive metastore
EMRSpark batch replacing Hadoop: PySpark and Scala jobsTransient clusters (created per batch, terminated after); core nodes On-Demand, task nodes Spot
RedshiftWarehouse replacing the Oracle DWDISTKEY/SORTKEY design, COPY + MERGE, Spectrum for lake data, materialized views, UNLOAD
Kinesis + FirehoseReal-time clickstream replacing FlumeOn-demand streams; Firehose buffers and writes to S3 raw
DynamoDBIdempotency keys and running balances for the APIPoint-in-time recovery; global table for DR
AthenaServerless SQL on S3Partition projection; a 50 GB per-query scan limit protects cost
OpenSearchSearch over transactions and logsEncryption at rest, HTTPS, node-to-node encryption

What changes when Hadoop moves to EMR

On-premises HadoopOn AWSConsequence
hdfs:// pathss3:// pathsStorage is separate from compute and never lost when a cluster ends
Hive metastoreGlue Data CatalogOne catalog shared by EMR, Athena, Redshift Spectrum and Glue
Long-lived 10-node clusterTransient clusters per jobPay only while jobs run; upgrade Spark versions per job
Spark 2.4Current Spark on EMRTest jobs for API changes (Scala 2.11 → 2.12/2.13, deprecated configs)
-- Load historical warehouse data exported by DMS as Parquet
COPY analytics.fact_transactions
FROM 's3://acme-lake-analytics/dw-history/fact_transactions/manifest.json'
IAM_ROLE 'arn:aws:iam::111122223333:role/acme-redshift-copy'
FORMAT AS PARQUET
MANIFEST;

Illustrative Redshift SQL; the account ID and role are placeholders.

Related guides: AWS Glue, Amazon EMR, Amazon Redshift, AWS DMS, Amazon Kinesis, Amazon Athena.

9. CI/CD: Every Change Through a Pipeline

GitHub -> CodePipeline
            1 Source
            2 Build      CodeBuild: pytest, cfn-lint, checkov (IaC security scan), terraform plan
            3 Approve    manual approval of the saved plan (change management)
            4 Infra      CodeBuild: terraform apply of exactly that saved plan
            5 Deploy     ServerlessApi: SAM -> primary + DR regions
                         WebAppEc2:     CodeDeploy rolling update
                         DataJobs:      Glue / EMR scripts and jar -> S3
PrincipleHow it is appliedWhy
Apply what was approvedThe plan file from the build stage is the one appliedNo surprise changes between review and apply
Shift security leftCheckov and cfn-lint scan infrastructure code on every changeMisconfigurations caught before they exist
DR never driftsServerless code is deployed to the DR region on every releaseFailover runs the same version as production
Automatic rollbackCodeDeploy and Lambda canaries roll back on CloudWatch alarmsFailed releases recover without a human
Data jobs are artefacts tooGlue and EMR scripts and the Scala jar are versioned and published to S3Reproducible data pipelines

10. Security and Encryption

Security, operations, CI/CD and disaster recovery: IAM, KMS, CloudHSM, Secrets Manager, WAF, ACM and Systems Manager controls; CloudWatch, CloudTrail, Config, GuardDuty, flow logs, X-Ray and SNS; the CodePipeline flow; and the Mumbai to Hyderabad DR lifecycleOpen full size ↗

Encryption at rest and in motion

LayerAt restIn motion
EC2 / EBSKMS-encrypted gp3 volumesTLS at the ALB; IMDSv2
RDSKMS for storage, snapshots and Performance InsightsTLS required (parameter groups; Oracle native network encryption)
S3SSE-KMS with bucket keysBucket policy denies non-TLS requests (aws:SecureTransport)
RedshiftKMS (or an HSM-backed key)SSL connections; enhanced VPC routing
DynamoDB, Kinesis, SQSKMSHTTPS APIs
OpenSearchKMSHTTPS enforced, node-to-node encryption
Backups / replicasKMS (multi-region keys in DR)AWS backbone
On-premises link—IPsec VPN (AES-256-GCM); TLS over Direct Connect

Identity, keys and other controls

ControlImplementationExpert point
IAMOne role per workload with only the actions it needs; a permission boundary blocking IAM, KMS-admin and CloudTrail tampering; IAM Access Analyzer; no access keysPermission boundaries cap what even a delegated admin can grant
KMSOne key per data class, yearly rotation, multi-region keys for DRSeparate keys limit the blast radius and let key policies differ per data class
CloudHSMCustom key store for the most sensitive keys (single-tenant, FIPS 140-3 Level 3)Used when regulation requires keys in dedicated hardware
Secrets ManagerSource DB credentials for DMS; RDS master passwords generated and rotated by RDSNo passwords in code or Terraform state
WAFAWS managed rules (common, known bad inputs, SQL injection, IP reputation) + per-IP rate limits on ALB and API Gateway; credentials redacted from WAF logsManaged rule groups are kept current by AWS
No SSHSSM Session Manager, sessions recordedNo open port 22, no key distribution, full audit
Detective controlsAWS Config rules, GuardDuty, VPC flow logsDetect drift and threats continuously
Say this in the interview

"Everything is encrypted at rest with KMS (one key per data class, multi-region keys for DR, CloudHSM-backed keys for the most sensitive data) and in motion with TLS 1.2+ and IPsec. IAM uses one least-privilege role per workload plus a permission boundary, secrets live in Secrets Manager with rotation, WAF protects the ALB and API Gateway, admins use SSM instead of SSH, and Config, GuardDuty and flow logs provide detection."

11. Monitoring and Audit

ToolAnswersIn this project
CloudWatch metrics + alarmsIs it healthy?ALB 5xx and latency, unhealthy hosts, RDS CPU and storage, replica lag, Kinesis iterator age, DMS CDC latency, Redshift health
CloudWatch LogsWhat happened inside?JSON application logs, Lambda, API access logs, VPN, WAF, RDS and Redshift audit logs
Log metric filtersBusiness and security signalsPayment failures, root login, unauthorised calls, IAM, KMS and security-group changes
CloudWatch dashboardOne view for operations and migration progressmonitoring.tf
CloudTrailWho did what, when?Multi-region, log file validation, S3 and Lambda data events, Object Lock bucket retained 7 years
X-RayWhere is the latency?API Gateway → Lambda → RDS / DynamoDB traces
SNSWho gets told?One alert topic → on-call

Two migration-specific alarms deserve special attention: DMS CDC latency (if it grows, the cutover window grows) and Kinesis iterator age (if it grows, consumers are falling behind real time).

12. Cutover and Rollback

WhenChecklist (per wave)
T-2 weeksDMS and MGN replication healthy, test instances verified, validation report green, rollback plan approved, stakeholders informed
T-1 dayLower DNS TTLs (e.g. 60 seconds), freeze changes, confirm backups
Cutover windowStop writes on-premises → wait for DMS CDC latency ≈ 0 → final validation → MGN cutover / stop DMS → switch connection strings (SSM parameters) and DNS → smoke tests → go / no-go
Hyper-care (2–4 weeks)Watch dashboards and alarms; keep on-premises systems available but read-only
DecommissionSwitch off on-premises once the rollback window has passed

Rollback during the migration

Until decommissioning, on-premises is the fallback. For databases, a reverse DMS task (AWS → on-premises CDC) keeps the old system current after cutover, so going back does not lose the transactions made in AWS. Without reverse replication, rollback after hours of live traffic would mean losing data, and the go/no-go decision becomes far more stressful.

Lowering DNS TTLs a day in advance matters because resolvers cache records for the old TTL; if it was 24 hours, some users would keep reaching on-premises for a day after the switch.

13. Disaster Recovery and Business Continuity

In one sentence: if the primary region (Mumbai) becomes unavailable, the platform is brought up in the DR region (Hyderabad) using data that is continuously replicated or backed up there, following a scripted and regularly tested runbook, with recovery targets agreed per application tier. Both regions are in India, so data residency holds even during a disaster.

Key terms

TermQuestion it answersExample
RPO (Recovery Point Objective)How much data can we afford to lose?"At most 5 minutes of transactions"
RTO (Recovery Time Objective)How long can we be down?"Back online within 1 hour"
FailoverSwitching production to the DR regionPromote replica, scale up, move DNS
FailbackReturning to the primary region afterwardsReverse replication, planned switch
DR drillPractising failover without a real disasterQuarterly

Lower RPO and RTO cost more. That is why targets are set per tier, not as one number for everything.

What protects against what

EventHandled byCategory
Server or instance failureAuto Scaling replaces it; EC2 host recoveryHigh availability
One Availability Zone failsMulti-AZ RDS, subnets in 3 AZs, ALB across AZsHigh availability
Accidental delete, bad change, corruptionRDS point-in-time restore, S3 versioning, DynamoDB PITR, AWS BackupOperational recovery
Ransomware or a malicious adminBackup Vault Lock, CloudTrail Object Lock, KMS key policiesResilience
Whole region unavailableFailover to ap-south-2Disaster recovery

High availability and DR are different things: Multi-AZ protects against a data-centre failure inside a region, but replicates corruption and deletions instantly. Only backups and point-in-time recovery protect against bad data, and only a second region protects against a regional outage.

The four AWS DR strategies

StrategyWhat runs in DRRPO / RTOCostUsed here for
Backup & restoreNothing, only backupsHours / hoursLowestOracle, SQL Server, Redshift, EMR
Pilot lightData replicated, compute offMinutes / tens of minutesLowWeb tier + MySQL
Warm standbyA small running copySeconds–minutes / minutesMediumServerless API + DynamoDB
Multi-site active/activeFull copy serving traffic≈0 / ≈0HighestNot needed (DynamoDB global tables are already active)

Tiers and targets

TierComponentsStrategyRPORTO
0Accounts API (Lambda + API Gateway), DynamoDB stateWarm standby / active data≈0 (seconds)15 min
1Customer Portal (EC2) + MySQLPilot light, replica promotion≤ 5 min1 h
1Core accounts (Oracle), payments (SQL Server)Backup & restore from 4-hourly cross-region copies≤ 4 h4 h
1Rehosted servers (risk engine)AWS Elastic Disaster RecoverySecondsMinutes
2Data lake (S3), Glue catalogS3 replication with 15-minute Replication Time Control; catalog re-created15 min24 h
2RedshiftSnapshot copies24 h24 h
2EMRNothing to replicate (no data on clusters); re-created—24 h

If the business needs Oracle or SQL Server below a 4-hour RPO, the next step is a cross-region read replica (RDS for Oracle with Active Data Guard licensing, or SQL Server Enterprise), at extra licence and instance cost.

How each component is protected

ComponentMechanism
VPC, subnets, security groups, TGW, VPNPre-built in DR by the same Terraform module
Connectivity to on-premisesGlobal DX Gateway reaches the DR Transit Gateway; second VPN to DR
Web tierDR launch template + Auto Scaling group at 0; ALB pre-created; AMIs copied by the pipeline
Serverless APIDeployed to both regions on every release
MySQLCross-region read replica → promote
Oracle, SQL Server, EBSAWS Backup every 4 hours + daily, copied to the DR vault
DynamoDBGlobal tables (replica in DR, active)
S3 raw / curatedCross-region replication with Replication Time Control (15 minutes)
RedshiftAutomatic snapshot copy to DR
Rehosted serversElastic Disaster Recovery (block replication, point-in-time)
Encryption keysMulti-region KMS keys for S3, DynamoDB and Backup; separate DR keys for logs and RDS
Secrets and configurationSSM parameters per region; RDS secrets re-created on promotion
DNSRoute 53 health checks + failover records
Audit logsMulti-region CloudTrail; Object Lock bucket

Failover runbook

Decision: the incident commander declares a disaster when the primary region is impaired beyond the tier RTOs and AWS Health does not indicate a quick recovery. Never fail over automatically on a single alarm: a wrong failover is itself an outage.

#StepHowTarget time
1Declare, notify, freeze changes; stop writes reaching the primary if it is partly aliveIncident call0–10 min
2Dry run the script to see the planpython dr/failover.py --env prod10 min
3Promote the MySQL replica, then enable Multi-AZfailover.py --execute15–25 min
4Restore Oracle and SQL Server from the latest DR backup copiesfailover.py --execute1–3 h
5Scale the web Auto Scaling group from 0 to production sizefailover.py --execute10 min
6Point configuration (SSM) at DR endpointsfailover.py --execute5 min
7Route 53 fails over on the health check (verify or force)Route 531–3 min
8Recover rehosted serversdr/drs_setup.sh recover <id>15–30 min
9Smoke tests, alarms green, communicateDashboard—
10Tier 2: restore Redshift snapshot, re-run data jobs in DR, re-create EMRPipelineWithin 24 h

Failback

Keeping DR ready

PracticeFrequencyTool
Readiness check: backup age, replica lag, S3 replication latency, DynamoDB replica, Redshift snapshotDailydr/verify_backups.py (alerts on failure)
Automated restore test of backupsMonthlyAWS Backup restore testing
DRS recovery drill (non-disruptive)Quarterlydr/drs_setup.sh drill
Full DR game day: fail over a non-production copy, measure real RPO and RTOTwice a yeardr/failover.py, runbook
Review targets with the businessYearlyDR document

Record the RPO and RTO actually achieved in every drill. If they miss the targets, either invest (for example warm standby instead of pilot light) or agree new targets with the business; never leave the gap undocumented.

Cost of DR, and DR during the migration

ItemStanding cost in DR
Pilot-light web tierALB + 1 NAT gateway only (no instances)
MySQL replicaOne instance (single-AZ until promoted)
DynamoDB global tablesReplicated writes + storage
Backups, S3 replicas, Redshift snapshotsStorage (infrequent-access and cold tiers)
Elastic Disaster RecoverySmall replication servers + low-cost staging volumes
Oracle / SQL ServerNo running instances: restored only when needed, so no standing licence cost

Until the data centre is closed, on-premises is the DR site for migrated applications: reverse DMS tasks keep on-premises databases current, VPN and DX paths and on-premises servers stay available read-only during hyper-care, and the cloud-only DR model takes over only after decommission sign-off.

Say this in the interview

"DR targets are set per tier because lower RPO and RTO cost more. The API and DynamoDB are warm standby with global tables, RPO seconds and RTO 15 minutes; the portal is pilot light with a MySQL cross-region replica, RPO 5 minutes and RTO 1 hour; Oracle and SQL Server use 4-hourly cross-region backups, RPO and RTO 4 hours; rehosted servers use Elastic Disaster Recovery; the data platform recovers within 24 hours. Failover is a human decision executed by a script with a dry run, Route 53 moves traffic, readiness is checked daily and drills run quarterly."

14. Interview-Ready Summary and Questions

Say this in the interview

"I led the migration of a data centre to AWS in 12 months, with data kept in India: Mumbai primary, Hyderabad DR. We assessed with Application Discovery and the 7 Rs, then built a Terraform landing zone: a three-tier, three-AZ VPC, Transit Gateway with Direct Connect primary and VPN backup, KMS and CloudHSM, CloudTrail, Config and GuardDuty, and a CodePipeline that applies only approved plans."

"We migrated in waves: rehosted web servers and a licensed risk engine with MGN (the engine on a Dedicated Host), replatformed Oracle and SQL Server to Multi-AZ RDS with DMS full load and CDC for minutes of downtime, refactored the REST API to API Gateway and Lambda with idempotency and RDS Proxy, moved the Oracle DW to Redshift via S3 Parquet and COPY, Hadoop to transient EMR on S3 with the Glue catalog, file shares with DataSync and Snowball, and Flume to Kinesis and Firehose."

"Every wave had a cutover checklist, independent validation with counts, sums and hashes, reverse DMS for rollback, and hyper-care. After migration, DR is tiered (warm standby, pilot light, backup and restore, Elastic Disaster Recovery) with scripted failover, daily readiness checks and quarterly drills."

QuestionAnswer
What are the 7 Rs, and how did you choose?Retire, retain, rehost, relocate, repurchase, replatform, refactor. Rehost for speed (web, risk engine), replatform to remove operations work (Oracle → RDS, Hadoop → EMR), refactor where cloud-native gives clear value (API → Lambda, Flume → Kinesis), retire what nobody uses
How do you migrate a 3.5 TB Oracle database with minimal downtime?DMS full load plus CDC while applications stay on-premises; prerequisites (archive and supplemental logging); parallel load and tuned LOB settings; then freeze writes, wait for CDC latency ≈ 0, validate, switch connection strings. Downtime is minutes
Direct Connect or VPN?Both: DX for predictable bandwidth and latency (primary), VPN for encrypted backup and day-one connectivity. BGP prefers DX. DX is not encrypted by default, so use TLS, MACsec or VPN over DX for sensitive traffic
Why a Dedicated Host for the risk engine?Its licence is per core; a Dedicated Host exposes physical sockets and cores and keeps the instance on the same host (affinity), so BYOL licensing stays compliant
How do you prevent double posting in a serverless API?An Idempotency-Key header, a DynamoDB conditional write that only succeeds for new keys, and a unique constraint in the database as a second guard
Why RDS Proxy with Lambda?Lambda scales to many concurrent executions, each opening connections; RDS Proxy pools and reuses them, and supports IAM authentication instead of stored passwords
What changes when Hadoop moves to EMR?hdfs:// becomes s3://, the Hive metastore becomes the Glue Data Catalog, and clusters become transient because no data lives on them
How do you validate a migration?Row counts, column sums and sampled row hashes per table, plus DMS validation and business reconciliation. Counts alone can hide changed values
How do you roll back after cutover?Keep on-premises read-only during hyper-care and run a reverse DMS task (AWS → on-premises) so switching back loses no transactions
What is the difference between pilot light and warm standby?Pilot light replicates data with compute switched off (scale up on failover); warm standby runs a small but working copy. Warm standby recovers faster and costs more
Multi-AZ vs cross-region replica vs backups?Multi-AZ survives a data-centre failure inside a region; a cross-region replica survives a regional outage; backups and PITR protect against corruption and deletion, which replicas copy instantly
Why not fail over automatically?A wrong failover is itself an outage and can cause split-brain; a human declares the disaster, a script executes it

15. Glossary

TermMeaning
7 RsThe seven migration strategies: retire, retain, rehost, relocate, repurchase, replatform, refactor
AZAvailability Zone: an isolated group of data centres inside a region
CDCChange data capture: streaming every insert, update and delete from a database
CutoverThe moment users switch from the old system to the new one
Direct Connect (DX)Private network connection between a data centre and AWS
DMSDatabase Migration Service: copies databases with full load + CDC
DRSElastic Disaster Recovery: continuous replication of servers to another region
IMDSv2Session-based version of the EC2 instance metadata service; blocks credential theft through SSRF
Landing zoneThe base AWS setup (accounts, network, security, logging) before workloads move
MGNApplication Migration Service: lift-and-shift of servers by block replication
Multi-AZA synchronous standby copy in another AZ with automatic failover
Pilot lightDR strategy: data replicated, compute switched off until needed
RPO / RTOHow much data you can lose / how long you can be down
Transit GatewayRegional network hub connecting VPCs, VPNs and Direct Connect
Warm standbyDR strategy: a scaled-down but running copy of production