SA Pro Lab 06 — Replicate a database with DMS and change data capture

Scaffold: 1/5. The world around the migration is built: the source database, the target bucket, the network, the roles. The migration itself — all four DMS resources — is yours to design and build from a requirement.

The scenario

A production database has to move, and the business will not take an outage window big enough to dump-and-restore it. The migration shape that solves this is full load plus change data capture: bulk-copy the rows that exist, and while that copy runs (and after it finishes), tail the source’s binary log and apply every new change to the target. When the CDC lag is near zero, the cutover is minutes, not hours.

The source here is Aurora MySQL, configured the way CDC demands (binlog_format=ROW) and with the Data API enabled so the lab can run SQL through the AWS CLI — no client, no driver, no public endpoint. The target is S3, DMS’s utility-knife target: the same pattern lands a full load for a data lake, stages CDC for downstream replay, or feeds an audit trail. Swapping the target endpoint for another database engine is the same architecture.

The requirement

Three rows exist in labdb.orders before the migration starts. After your DMS resources deploy and the task runs: the three rows land in S3 as a bulk-copy file, and two rows inserted after the full load arrive in S3 as CDC changes, with no second bulk copy.

What’s provided

Your task

Build the migration in src/template.yaml:

  1. A replication instance — the worker (dms.t3.micro, private, identifier sa-pro-lab-06 so the test can find it).
  2. A source endpoint — engine aurora, pointing at the cluster’s writer endpoint, password resolved from the same secret the cluster uses.
  3. A target endpoint — engine s3, using the provided role and bucket, with addColumnName=true so the CSVs carry headers.
  4. A replication taskfull-load-and-cdc, identifier sa-pro-lab-06-task, with a table mapping that includes schema labdb, table %.

Run it

# Defaults: stack sa-pro-lab-06, region ap-southeast-2.
./scripts/deploy.sh          # 15-20 min first time: Aurora + DMS in parallel
./scripts/test.sh            # seeds, starts the task, proves full load then CDC
./scripts/teardown.sh        # deletes everything (several minutes)

This is the track’s most expensive lab while running — roughly US$0.15–0.30 an hour across Aurora Serverless v2 and the DMS instance. Tear it down when you’re done; the deploy tags the stack for the lab reaper as a backstop.

What success looks like

./scripts/test.sh prints the arc of the migration:

  full load complete: 3 rows copied.

What landed in S3 (the LOAD file is the bulk copy):
  ... LOAD00000001.csv

Inserting two NEW rows into the source (ids 1042, 1043) ...
Waiting for CDC to carry them across ...
  CDC delivered: 2 change rows applied since the full load.

PASS: the full load copied the existing rows, and rows written afterwards
flowed across via CDC with no second bulk copy.

With the shipped template the test stops early: no task exists, and it tells you what to build.

If it fails

Reveal the solution

SRC=solution ./scripts/deploy.sh && ./scripts/test.sh

What you just learned

Next

The rest of the SA Pro lab track is listed in labs/README-sa-pro.md.