startReplication method

Future<StartReplicationResponse> startReplication({
  1. required String replicationConfigArn,
  2. required String startReplicationType,
  3. String? cdcStartPosition,
  4. DateTime? cdcStartTime,
  5. String? cdcStopPosition,
  6. String? premigrationAssessmentSettings,
})

For a given DMS Serverless replication configuration, DMS connects to the source endpoint and collects the metadata to analyze the replication workload. Using this metadata, DMS then computes and provisions the required capacity and starts replicating to the target endpoint using the server resources that DMS has provisioned for the DMS Serverless replication.

May throw AccessDeniedFault. May throw InvalidResourceStateFault. May throw ResourceNotFoundFault.

Parameter replicationConfigArn : The Amazon Resource Name of the replication for which to start replication.

Parameter startReplicationType : The replication type.

When the replication type is full-load or full-load-and-cdc, the only valid value for the first run of the replication is start-replication. This option will start the replication.

You can also use ReloadTables to reload specific tables that failed during replication instead of restarting the replication.

The resume-processing option isn't applicable for a full-load replication, because you can't resume partially loaded tables during the full load phase.

For a full-load-and-cdc replication, DMS migrates table data, and then applies data changes that occur on the source. To load all the tables again, and start capturing source changes, use reload-target. Otherwise use resume-processing, to replicate the changes from the last stop position.

Parameter cdcStartPosition : Indicates when you want a change data capture (CDC) operation to start. Use either CdcStartPosition or CdcStartTime to specify when you want a CDC operation to start. Specifying both values results in an error.

The value can be in date, checkpoint, or LSN/SCN format.

Parameter cdcStartTime : Indicates the start time for a change data capture (CDC) operation. Use either CdcStartTime or CdcStartPosition to specify when you want a CDC operation to start. Specifying both values results in an error.

Parameter cdcStopPosition : Indicates when you want a change data capture (CDC) operation to stop. The value can be either server time or commit time.

Parameter premigrationAssessmentSettings : User-defined settings for the premigration assessment. The possible values are:

  • ResultLocationFolder: The folder within an Amazon S3 bucket where you want DMS to store the results of this assessment run.
  • ResultEncryptionMode: The supported values are SSE_KMS and SSE_S3. If these values are not provided, then the files are not encrypted at rest. For more information, see Creating Amazon Web Services KMS keys to encrypt Amazon S3 target objects.
  • ResultKmsKeyArn: The ARN of a customer KMS encryption key that you specify when you set ResultEncryptionMode to SSE_KMS.
  • IncludeOnly: A space-separated list of names for specific individual assessments that you want to include. These names come from the default list of individual assessments that Database Migration Service supports for the associated migration.
  • Exclude: A space-separated list of names for specific individual assessments that you want to exclude. These names come from the default list of individual assessments that Database Migration Service supports for the associated migration.
  • FailOnAssessmentFailure: A configurable setting you can set to true (the default setting) or false. Use this setting to to stop the replication from starting automatically if the assessment fails. This can help you evaluate the issue that is preventing the replication from running successfully.

Implementation

Future<StartReplicationResponse> startReplication({
  required String replicationConfigArn,
  required String startReplicationType,
  String? cdcStartPosition,
  DateTime? cdcStartTime,
  String? cdcStopPosition,
  String? premigrationAssessmentSettings,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonDMSv20160101.StartReplication'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ReplicationConfigArn': replicationConfigArn,
      'StartReplicationType': startReplicationType,
      if (cdcStartPosition != null) 'CdcStartPosition': cdcStartPosition,
      if (cdcStartTime != null)
        'CdcStartTime': unixTimestampToJson(cdcStartTime),
      if (cdcStopPosition != null) 'CdcStopPosition': cdcStopPosition,
      if (premigrationAssessmentSettings != null)
        'PremigrationAssessmentSettings': premigrationAssessmentSettings,
    },
  );

  return StartReplicationResponse.fromJson(jsonResponse.body);
}