constructor()

in lib/dms-stack.ts [12:54]


  constructor(scope: cdk.Construct, id: string, props: DmsProps) {
    super(scope, id, props);
    const context: ContextProps = propsWithDefaults(props.context);

    const dmsProps = {
      subnetIds: context.subnetIds,
      replicationSubnetGroupIdentifier: context.replicationSubnetGroupIdentifier,
      replicationInstanceClass: context.replicationInstanceClass,
      replicationInstanceIdentifier: context.replicationInstanceIdentifier,
      vpcSecurityGroupIds: context.vpcSecurityGroupIds,
      engineName: 'mysql',
      region: Stack.of(this).region,
    };

    const dmsReplication = new DMSReplication(this, 'Replication', dmsProps);
    const suffix = context.replicationInstanceIdentifier;


    context.schemas.forEach(schema => {
      const source = dmsReplication.createMySQLEndpoint(
        'source-' + schema.name + '-' + suffix,
        'source',
        schema.sourceSecretsManagerSecretId,
        schema.sourceSecretsManagerRoleArn
      );

      const target = dmsReplication.createMySQLEndpoint(
        'target-' + schema.name + '-' + suffix,
        'target',
        schema.targetSecretsManagerSecretId,
        schema.targetSecretsManagerRoleArn
      );

      dmsReplication.createReplicationTask(
        schema.name + '-replication-' + suffix,
        schema.name,
        source,
        target,
        context.migrationType,
        context.replicationTaskSettings
      );
    });
  }