Engineers often struggle with the "all or nothing" dilemma when migrating operational data. You either run a massive full-load dump that locks resources and creates stale reports, or you attempt a complex, custom-coded incremental sync that inevitably drifts from the source schema. AWS Database Migration Service (DMS) solves this by combining a full load with Change Data Capture (CDC), allowing you to bootstrap an analytics platform without downtime.
However, the default settings in DMS often lead to silent failures—specifically regarding Large Object (LOB) truncation and inconsistent target data. If you don't explicitly tune your task settings, you risk losing data in columns like TEXT, JSON, or BLOB fields, or discovering that your target table has drifted from the source weeks after the migration started. This article explains how to configure DMS tasks, manage LOB handling modes, and automate validation to ensure your target remains a faithful replica of your source. This scope covers DMS task settings and validation for relational database sources; it does not cover schema conversion or non-relational source specifics.
What you'll build
You will configure an AWS DMS replication task that performs a one-time migration of existing data followed by continuous incremental updates. You will also implement row-level validation to detect and report discrepancies.
flowchart LR
source["Amazon RDS (Source)"]
dms["AWS DMS Replication Instance"]
target["Amazon S3 (Target)"]
dms -->|"Full Load + CDC"| target
source -->|"Binlog/WAL"| dms
Prerequisites
- AWS CLI v2 installed and configured with appropriate credentials.
- Source Database: An Amazon RDS instance with
binlog(MySQL) orlogical decoding(PostgreSQL) enabled. - Target: An Amazon S3 bucket for the data landing zone.
- IAM: A replication instance role and a DMS service role (often
dms-vpc-roleanddms-access-for-endpoint).
Step 1: Define LOB handling strategy
DMS offers three LOB modes. The default, "Limited LOB," truncates LOBs to a maximum size (default 32KB), which is a recipe for data loss in modern applications. "Full LOB" mode retrieves LOBs individually, which is slower but safe. "Inline LOB" is the performance-oriented middle ground.
For most production pipelines, I recommend Inline LOB if your LOBs are generally under a specific size (e.g., 100KB). If you have massive files, use Full LOB to avoid memory errors.
Use the following JSON configuration for your task settings to enable Inline LOB mode:
{
"TargetMetadata": {
"TargetSchema": "",
"SupportLobs": true,
"FullLobMode": false,
"InlineLobMaxSize": 102400
}
}
Verify your setting by running the describe-replication-tasks command and inspecting the ReplicationTaskSettings field to ensure InlineLobMaxSize matches your intended value.
Step 2: Enable validation for data integrity
DMS validation compares the source and target rows. It calculates checksums for data pages, which adds overhead but is the only way to detect silent data corruption or missed transactions. Without this, you are effectively flying blind.
Add the following to your task settings JSON to enable continuous validation:
{
"ValidationSettings": {
"ValidationMode": "ROW_LEVEL",
"EnableValidation": true,
"RecordFailureDelayInMinutes": 5,
"MaxFailureRecords": 100
}
}
Update your task using the AWS CLI:
aws dms modify-replication-task \
--replication-task-arn <your-task-arn> \
--replication-task-settings file://task-settings.json
Verify validation status in the AWS Management Console under the "Table statistics" tab, where you should see a "Validation state" column populated with values like Validated or Mismatched.
Step 3: Configure CDC start points
When running a full load followed by CDC, you must specify how DMS tracks the source logs. If you are migrating from a snapshot, you need to capture the Log Sequence Number (LSN) or Binary Log position at the time of the snapshot.
If you are starting from a live system, use CDC_START_CURRENT to begin replication from the current moment. If you are migrating a snapshot, you must provide the specific log position from your source database metadata:
{
"CDCStartPosition": "0000000000000000",
"CDCStartSource":"<your-lsn-or-binlog-file-position>"
}
Verify by checking the CloudWatch logs for the replication task; look for the "CDC started at..." message.
Design decisions
- Inline LOB, not Limited LOB. Limited LOB mode truncates data without throwing an error, leading to corrupt analytics. Inline LOB handles small objects efficiently and only falls back to full LOB fetches for larger items.
- Row-level validation, not Table-level. Table-level validation only checks row counts. If your row counts match but specific column values are truncated or incorrect, the pipeline remains "healthy" while providing bad data. Row-level validation is the only way to guarantee parity.
- S3 Target, not direct-to-database. If you are building a data lake, landing in S3 via DMS allows you to use tools like AWS Glue or Amazon Athena to transform data. Writing directly to a target relational database can cause index contention and lock waits during the high-throughput full-load phase.
Troubleshooting
- Symptom: Task fails during full load with "Out of memory" errors.
- Cause: The replication instance is too small for the table size or the number of concurrent LOB fetches.
-
Fix: Increase the replication instance class (e.g., from
dms.t3.mediumtodms.c5.large) or reduce theParallelLoadThreadssetting.
- Symptom: Validation shows "Mismatched" records.
- Cause: DDL changes occurred on the source that were not applied to the target, or incompatible data types.
- Fix: Check the source table schema and the target table DDL. If the source schema changed, you may need to reload the affected tables.
- Symptom: CDC is falling behind (latency is increasing).
- Cause: The replication instance has insufficient CPU/IOPS to process the incoming transaction log rate.
-
Fix: Enable Multi-AZ on the replication instance and monitor the
CDCLatencySourceandCDCLatencyTargetmetrics in CloudWatch.
Clean up
To avoid ongoing costs, delete the resources you created:
# Delete the replication task
aws dms delete-replication-task --replication-task-arn <task-arn>
# Delete the replication instance
aws dms delete-replication-instance --replication-instance-arn <instance-arn>
Remember to also delete the S3 objects or buckets if they are no longer needed, and disable any IAM roles created specifically for this task if they are no longer in use.
Conclusion
AWS DMS is a powerful tool for bridging the gap between operational databases and analytics platforms, provided you move beyond the default settings. By explicitly defining your LOB handling and enabling row-level validation, you transform a fragile sync into a reliable data pipeline.
Try it: Configure a task with FullLobMode: false and InlineLobMaxSize: 51200 to see how it handles your specific application's text fields without the performance penalty of full LOB retrieval.
References
About the examples: automated checks confirmed that the JSON blocks parse and that 3 AWS CLI commands match the AWS service API models (operation and parameter names). The examples have not been run end to end, so test them in a non-production environment before relying on them.
Cover photo by Joseph Greve on Unsplash.
This article was drafted with AI assistance and is intended for technical review and fact-checking before publication.
Top comments (0)