Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
DmsMigrationPipeline
✓ import { DmsMigrationPipeline } from 'cdk-dms-replication'
✗ const DmsMigrationPipeline = require('cdk-dms-replication').DmsMigrationPipeline
The package is ESM-only. Named import from the package.
EndpointEngine
✓ import { EndpointEngine } from 'cdk-dms-replication'
✗ import { EndpointEngine } from 'aws-cdk-lib/aws-dms'
EndpointEngine is a custom enum provided by this package, not from aws-cdk-lib.
TableMappings
✓ import { TableMappings } from 'cdk-dms-replication'
✗ const TableMappings = require('cdk-dms-replication');
Named import. TableMappings is a fluent builder class.
Provision a complete DMS migration pipeline (replication instance, source/target endpoints, task) in ~20 lines of CDK code using DmsMigrationPipeline.
import * as cdk from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import {
DmsMigrationPipeline,
EndpointEngine,
MigrationType,
TableMappings,
} from 'cdk-dms-replication';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'MigrationStack');
const vpc = ec2.Vpc.fromLookup(stack, 'Vpc', { isDefault: false });
new DmsMigrationPipeline(stack, 'Pipeline', {
vpc,
migrationType: MigrationType.FULL_LOAD_AND_CDC,
sourceEndpoint: {
engine: EndpointEngine.MYSQL,
serverName: 'mysql.internal.example.com',
port: 3306,
username: 'dms_user',
password: cdk.SecretValue.secretsManager('mysql-dms-password'),
databaseName: 'orders',
},
targetEndpoint: {
engine: EndpointEngine.AURORA_POSTGRESQL,
serverName: cluster.clusterEndpoint.hostname,
port: 5432,
username: 'dms_user',
password: cdk.SecretValue.secretsManager('aurora-dms-password'),
databaseName: 'orders',
},
tableMappings: new TableMappings()
.includeSchema('public')
.excludeTable('public', 'audit_log')
.toJson(),
});
Debug
Known issues
deprecatedThe 'password' field in endpoint config is deprecated; use 'secretsManagerSecretId' with AWS Secrets Manager instead.fixReplace 'password: cdk.SecretValue.secretsManager(...)' with 'secretsManagerSecretId: 'your-secret-arn'' for better security.
affects: <=0.1.10
gotchaDmsServerlessPipeline requires 'maxCapacityUnits' to be a power of two (1,2,4,8,16,32,64,128,192,256,384). Other values will cause deployment failure.fixSet maxCapacityUnits to one of the allowed values: 1,2,4,8,16,32,64,128,192,256,384.
affects: >=0.1.0 <=0.1.10
gotchaTableMappings builder returns a JSON string, not an object. Passing the string directly to 'tableMappings' property is correct; do not call JSON.parse() or JSON.stringify() again.fixUse the result of .toJson() directly: tableMappings: new TableMappings().excludeTable('public', 'logs').toJson() affects: >=0.1.0 <=0.1.10
breakingIn version 0.2.0 (planned), the 'sourceEndpoint' and 'targetEndpoint' properties will require ISecret instead of string-based passwords. Existing code using 'password' field will break.fixMigrate to use 'secretsManagerSecretId' and store passwords in Secrets Manager.
affects: <0.2.0
gotchaVPC passed to the construct must have at least two private subnets across different AZs. Using a VPC without private subnets or only one AZ will cause deployment failure.fixEnsure the VPC has at least two private subnets (e.g., cidrMask: 24, maxAzs: 2).
affects: >=0.1.0 <=0.1.10
Errors
Common errors & fixes
Error: The following resource(s) failed to create: [ReplicationInstance...]. InvalidParameterValue: The subnet ID 'subnet-xxx' does not exist.
VPC passed to the construct has a public subnet or the subnet ID is incorrect.
fixUse ec2.Vpc.fromLookup or fromAttributes with correct subnet IDs. Ensure using private subnets.
TypeError: Cannot read properties of undefined (reading 'toJson')
Forgot to call .toJson() on the TableMappings instance, or used an object literal instead.
fixAlways call .toJson() on TableMappings: new TableMappings().includeAll().toJson()
Resource handler returned message: "Invalid endpoint argument: 'Password' must be a string"
Provided a SecretValue object instead of a string for the password field (deprecated).
fixUse secretsManagerSecretId instead of password: sourceEndpoint: { ..., secretsManagerSecretId: 'my-secret-arn' } ValidationError: The parameter 'MaxCapacityUnits' must be one of the following values: 1,2,4,8,16,32,64,128,192,256,384
Set maxCapacityUnits to a non-allowed value on DmsServerlessPipeline.
fixSet maxCapacityUnits to a power of two from the allowed list: 1,2,4,8,16,32,64,128,192,256,384.
Audit
Dependencies
aws-cdk-librequiredPeer dependency for AWS CDK infrastructure constructs.
constructsrequiredPeer dependency for CDK construct base class.