All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::DTS::MigrationJob

Last Updated:Aug 12, 2024

ALIYUN::DTS::MigrationJob is used to purchase a data migration instance and configure a data migration task.

Note

We recommend that you use ALIYUN::DTS::Instance to purchase a Data Transmission Service (DTS) instance and ALIYUN::DTS::MigrationJob2 to configure a data migration task.

Syntax

{
  "Type": "ALIYUN::DTS::MigrationJob",
  "Properties": {
    "MigrationJobClass": String,
    "SourceEndpoint": Map,
    "MigrationJobName": String,
    "MigrationMode": Map,
    "DestinationEndpoint": Map,
    "MigrationObject": List
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

MigrationJobClass

String

Yes

No

The specification of the data migration instance.

Valid values:

  • small

  • medium

  • large

For more information about the performance test of each specification, see Specifications of data migration instances.

SourceEndpoint

Map

No

Yes

The configurations of the source instance.

None.

MigrationJobName

String

No

Yes

The name of the data migration task.

None.

MigrationMode

Map

No

Yes

The mode of the data migration task.

None.

DestinationEndpoint

Map

No

Yes

The configurations of the destination instance.

None.

MigrationObject

List

No

Yes

The objects that you want to migrate.

None.

SourceEndpoint syntax

"SourceEndpoint": {
  "UserName": String,
  "OracleSID": String,
  "InstanceID": String,
  "IP": String,
  "Region": String,
  "InstanceType": String,
  "Role": String,
  "DatabaseName": String,
  "OwnerID": String,
  "EngineName": String,
  "Password": String,
  "Port": String
}

SourceEndpoint properties

Property

Type

Required

Editable

Description

Constraint

UserName

String

Yes

Yes

The username that is used to access the source instance.

None.

OracleSID

String

No

Yes

The system ID (SID) of the source Oracle database if the engine type of the source instance is Oracle.

None.

InstanceID

String

No

Yes

The ID of the source instance.

You must specify this property based on the InstanceType value.

IP

String

No

Yes

The IP address of the source instance.

You must specify this property when the source instance is an on-premises self-managed database.

Region

String

Yes

Yes

The region ID of the source instance.

None.

InstanceType

String

Yes

Yes

The type of the source instance.

Valid values:

  • RDS: ApsaraDB RDS instance

  • ECS: self-managed database that is hosted on an Elastic Compute Service (ECS) instance

  • LocalInstance: self-managed database with a public IP address

  • Express: self-managed database that is connected over an Express Connect circuit

  • MongoDB: ApsaraDB for MongoDB instance

  • POLARDB: PolarDB for MySQL cluster

Role

String

No

Yes

The name of the Resource Access Management (RAM) role authorized by the Alibaba Cloud account to which the source instance belongs. This property takes effect when the source instance is an ApsaraDB RDS instance and the source and destination instances belong to different Alibaba Cloud accounts.

You must specify this property when you migrate data across different Alibaba Cloud accounts. For more information about the required permissions of the RAM role and how to grant the permissions to the RAM role, see Configure RAM authorization for cross-account DTS tasks.

DatabaseName

String

No

Yes

The database name.

This property specifies a database name that is used to establish a connection if the engine type of the source instance is PostgreSQL or MongoDB.

OwnerID

String

No

Yes

The ID of the Alibaba Cloud account to which the source instance belongs. This property takes effect when the source instance is an ApsaraDB RDS instance and the source and destination instances belong to different Alibaba Cloud accounts.

None.

EngineName

String

No

Yes

The engine type of the source instance.

Valid values:

  • MySQL

  • SQLServer

  • PostgreSQL

  • Oracle

  • MongoDB

  • Redis

You must specify this property when InstanceType is not set to RDS.

Password

String

Yes

Yes

The password that is used to access the source instance.

None.

Port

String

No

Yes

The listening port of the source instance.

You must specify this property when the source instance is a self-managed database.

MigrationMode syntax

"MigrationMode": {
  "DataIntialization": Boolean,
  "StructureIntialization": Boolean,
  "DataSynchronization": Boolean
}

MigrationMode properties

Property

Type

Required

Editable

Description

Constraint

DataIntialization

Boolean

No

Yes

Specifies whether to perform full data migration in the migration task.

Valid values:

  • true

  • false

StructureIntialization

Boolean

No

Yes

Specifies whether to perform schema migration in the migration task.

Valid values:

  • true

  • false

DataSynchronization

Boolean

No

Yes

Specifies whether to perform incremental data synchronization in the migration task.

Valid values:

  • true

  • false

DestinationEndpoint syntax

"DestinationEndpoint": {
  "UserName": String,
  "InstanceID": String,
  "IP": String,
  "Region": String,
  "Port": String,
  "Role": String,
  "DatabaseName": String,
  "EngineName": String,
  "Password": String,
  "InstanceType": String
}

DestinationEndpoint properties

Property

Type

Required

Editable

Description

Constraint

UserName

String

Yes

Yes

The username that is used to access the destination instance.

None.

InstanceID

String

No

Yes

The ID of the destination instance.

None.

IP

String

No

Yes

The IP address of the destination instance.

You must specify this property when the destination instance is an on-premises self-managed database.

Region

String

Yes

Yes

The region ID of the destination instance.

If the destination instance is a self-managed database, you can specify the ID of a region that is geographically closest to your self-managed data center.

Port

String

No

Yes

The listening port of the destination instance.

You must specify this property when the destination instance is a self-managed database.

DatabaseName

String

No

Yes

The database name of the destination instance.

You must specify this property when the engine type of the destination instance is PostgreSQL, PPAS, or MongoDB.

EngineName

String

No

Yes

The engine type of the destination database.

You must specify this property only when InstanceType is set to RDS, ECS, LocalInstance, or Express.

Password

String

Yes

Yes

The password that is used to access the destination instance.

None.

InstanceType

String

Yes

Yes

The type of the destination instance.

The value of this property must be the same as the value of SourceEndpoint.InstanceType.

Role

String

No

Yes

The name of the RAM role authorized by the Alibaba Cloud account to which the destination instance belongs. This property takes effect when the source instance is an ApsaraDB RDS instance and the source and destination instances belong to different Alibaba Cloud accounts.

None.

MigrationObject syntax

"MigrationObject": [
  {
    "TableExcludes": List,
    "NewSchemaName": String,
    "NewDBName": String,
    "TableIncludes": List,
    "SchemaName": String,
    "DBName": String
  }
]

MigrationObject properties

Property

Type

Required

Editable

Description

Constraint

TableExcludes

List

No

No

The names of tables that you do not want to migrate from the source database.

Example: [{"TableName": "a"}, {"TableName": "b"}, ...].

NewSchemaName

String

No

No

The mapped name of the schema that you want to migrate to the destination instance.

This property is available when EngineName is set to SQLServer.

NewDBName

String

No

No

The mapped name of the database that you want to migrate to the destination instance.

This property is unavailable when EngineName is set to SQLServer.

TableIncludes

List

No

No

The names of tables that you want to migrate from the source database.

None.

SchemaName

String

No

No

The name of the schema that you want to migrate.

This property is available when EngineName is set to SQLServer.

DBName

String

No

No

The name of the database that you want to migrate.

This property is unavailable when EngineName is set to SQLServer.

  • If you specify only the DBName property and leave additional properties in this table empty, the system migrates all objects contained in the database.

  • If you specify the DBName property and additional properties in this table, the system migrates only the objects that correspond to the specified properties by default.

TableIncludes syntax

"TableIncludes": [
  {
    "ColumnExcludes": List,
    "FilterCondition": String,
    "NewTableName": String,
    "TableName": String,
    "ColumnIncludes": List
  }
]

TableIncludes properties

Property

Type

Required

Editable

Description

Constraint

ColumnExcludes

List

No

No

The names of columns that you do not want to migrate from the source database.

Example: [{"ColumnName": "a"}, {"ColumnName": "b"}, ...]shou'xia.

FilterCondition

String

No

No

The filter condition.

None.

NewTableName

String

No

No

The mapped name of the table that you want to migrate to the destination instance.

None.

TableName

String

No

No

The name of the table that you want to migrate.

None.

ColumnIncludes

List

No

No

The names of columns that you want to migrate from the source table.

None.

ColumnIncludes syntax

"ColumnIncludes": [
  {
    "ColumnName": String,
    "NewColumnName": String
  }
]

ColumnIncludes properties

Property

Type

Required

Editable

Description

Constraint

ColumnName

String

No

No

The name of the column that you want to migrate from the source table.

None.

NewColumnName

String

No

No

The mapped name of the column that you want to migrate to the destination instance.

None.

ColumnExcludes syntax

"ColumnExcludes": [
  {
    "ColumnName": String
  }
]   

ColumnExcludes property

Property

Type

Required

Editable

Description

Constraint

ColumnName

String

No

No

The name of the column that you do not migrate from the source table.

None.

TableExcludes syntax

"TableExcludes": [
  {
    "TableName": String
  }
]   

TableExcludes property

Property

Type

Required

Editable

Description

Constraint

TableName

String

No

No

The name of the table that you do not want to migrate from the source database.

None.

Return values

Fn::GetAtt

MigrationJobId: the ID of the data migration task.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      RdsInstanceId:
        Type: String
        AssociationProperty: ALIYUN::RDS::Instance::InstanceId
    Resources:
      MigrationJob:
        Type: ALIYUN::DTS::MigrationJob
        Properties:
          MigrationJobClass: small
          MigrationJobName:
            Ref: ALIYUN::StackName
          MigrationMode:
            StructureIntialization: true
            DataSynchronization: true
            DataIntialization: true
          SourceEndpoint:
            UserName: admin
            InstanceID:
              Ref: RdsInstanceId
            Region:
              Ref: ALIYUN::Region
            InstanceType: RDS
            Password: Admin@123
            Port: '3306'
          DestinationEndpoint:
            EngineName: MySQL
            Port: '3306'
            Region:
              Ref: ALIYUN::Region
            InstanceID:
              Ref: RdsInstanceId
            Password: Admin@123
            UserName: admin
            InstanceType: RDS
          MigrationObject:
            - DBName: MySQLDataBase
    Outputs:
      MigrationJobId:
        Description: Migration tasks task ID
        Value:
          Fn::GetAtt:
            - MigrationJob
            - MigrationJobId
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "RdsInstanceId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::RDS::Instance::InstanceId"
        }
      },
      "Resources": {
        "MigrationJob": {
          "Type": "ALIYUN::DTS::MigrationJob",
          "Properties": {
            "MigrationJobClass": "small",
            "MigrationJobName": {
              "Ref": "ALIYUN::StackName"
            },
            "MigrationMode": {
              "StructureIntialization": true,
              "DataSynchronization": true,
              "DataIntialization": true
            },
            "SourceEndpoint": {
              "UserName": "admin",
              "InstanceID": {
                "Ref": "RdsInstanceId"
              },
              "Region": {
                "Ref": "ALIYUN::Region"
              },
              "InstanceType": "RDS",
              "Password": "Admin@123",
              "Port": "3306"
            },
            "DestinationEndpoint": {
              "EngineName": "MySQL",
              "Port": "3306",
              "Region": {
                "Ref": "ALIYUN::Region"
              },
              "InstanceID": {
                "Ref": "RdsInstanceId"
              },
              "Password": "Admin@123",
              "UserName": "admin",
              "InstanceType": "RDS"
            },
            "MigrationObject": [
              {
                "DBName": "MySQLDataBase"
              }
            ]
          }
        }
      },
      "Outputs": {
        "MigrationJobId": {
          "Description": "Migration tasks task ID",
          "Value": {
            "Fn::GetAtt": [
              "MigrationJob",
              "MigrationJobId"
            ]
          }
        }
      }
    }