ALIYUN::DTS::MigrationJob is used to purchase a database migration instance and 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 type of the migration instance. Valid values:
  • small
  • medium
  • large

For more information about the testing performance of each instance type, see Specifications of data migration instances.

SourceEndpoint Map No Yes The source instance configurations. None
MigrationJobName String No Yes The name of the migration task. None
MigrationMode Map No Yes The mode of the migration task. None
DestinationEndpoint Map No Yes The destination instance configurations. None
MigrationObject List No Yes The objects to be migrated. 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. None
InstanceID String No Yes The ID of the destination instance. You must specify this parameter based on the InstanceType value.
IP String No Yes The endpoint of the destination instance. This parameter is required if the destination instance is a user-created database.
Region String Yes Yes The region where the destination instance resides. None
InstanceType String Yes Yes The instance type of the source instance. Valid values:
  • RDS: ApsaraDB for RDS instance
  • ECS: user-created database that is hosted on ECS
  • LocalInstance: user-created databases with a public IP address
  • Express: user-created database that is connected over an Express Connect circuit
  • MongoDB: ApsaraDB for MongoDB instance
  • POLARDB: PolarDB for MySQL cluster
Role String No Yes The role name authorized by the Alibaba Cloud account to which the source RDS instance belongs. This parameter is available if the source and destination instances belong to different Alibaba Cloud accounts. This parameter is required when you migrate data across different Alibaba Cloud accounts. For more information about role permissions and how to grant permissions to a role, see Configure RAM authorization for cross-account data migration and synchronization.
DatabaseName String No Yes The name of the database. This parameter is used to establish a connection if the source instance is a PostgreSQL or MongoDB database.
OwnerID String No Yes The ID of the Alibaba Cloud account to which the source RDS instance belongs. This parameter is available if the source and destination instances belong to different Alibaba Cloud accounts. None
EngineName String No Yes The database engine that the source instance runs. Valid values:
  • MySQL
  • SQLServer
  • PostgreSQL
  • Oracle
  • MongoDB
  • Redis
This parameter is required if the InstanceType parameter 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 port on which the source instance is listening. This parameter is required if the source instance is a user-created database.

MigrationMode syntax

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

MigrationMode properties

Property Type Required Editable Description Constraint
DataIntialization Boolean No Yes Specifies whether the migration task performs full data migration. Valid values:
  • true
  • false
StructureIntialization Boolean No Yes Specifies whether the migration task performs schema migration. Valid values:
  • true
  • false
DataSynchronization Boolean No Yes Specifies whether the migration task performs incremental data synchronization. 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 endpoint of the destination instance. This parameter is required if the destination instance is a user-created database.
Region String Yes Yes The region where the destination instance resides. If the destination instance is a user-created database, select a region that is geographically closest to the on-premises data center.
Port String No Yes The port on which the destination instance is listening. This parameter is required if the destination instance is a user-created database.
DatabaseName String No Yes The database name of the destination instance used for establishing a connection. This parameter is required if the destination instance is a PostgreSQL, PPAS, or MongoDB database.
EngineName String No Yes The database engine that the destination instance runs. This parameter is available and required only when the InstanceType parameter is set to RDS, ECS, LocalInstance, or Express.
Password String Yes Yes The password that is used to access the destination instance. Valid values:
  • MySQL
  • SQLServer
  • PostgreSQL
  • PPAS
  • MongoDB or Redis
InstanceType String Yes Yes The instance type of the destination instance. This parameter value must be the same as the SourceEndpoint.InstanceType value.
Role String No Yes The role name authorized by the Alibaba Cloud account to which the source RDS instance belongs. This parameter is available if 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 not to be synchronized from the source database. Example: [{"TableName": "a"}, {"TableName": "b"}, ...]
NewSchemaName String No No The mapped name of the source schema in the destination instance. This parameter takes effect only when the EngineName parameter is set to SQLServer.
NewDBName String No No The mapped name of the source database in the destination instance. This parameter does not take effect only when the EngineName parameter is set to SQLServer.
TableIncludes List No No The tables to be migrated from the source database. None
SchemaName String No No The name of the schema to be migrated. This parameter takes effect only when the EngineName parameter is set to SQLServer.
DBName String No No The name of the database to be migrated. This parameter does not take effect when the EngineName parameter is set to SQLServer.
  • If you specify only the DBName parameter but do not specify lower levels of objects, all objects in the database are migrated.
  • If you specify both the DBName parameter and lower levels of some objects, other objects are not migrated 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 columns not to be migrated from the source database. Example: [{"ColumnName": "a"}, {"ColumnName": "b"}, ...]shou'xia.
FilterCondition String No No The filter condition. None
NewTableName String No No The name of the source table in the destination table. None
TableName String No No The name of the table to be migrated. None
ColumnIncludes List No No The columns to be migrated 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 names of the columns to be migrated from the source table. None
NewColumnName String No No The mapped name of the source column in the destination instance. None

ColumnExcludes syntax

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

ColumnExcludes properties

Property Type Required Editable Description Constraint
ColumnName String No No The name of the column not to be migrated from the source table. None

TableExcludes syntax

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

TableExcludes properties

Property Type Required Editable Description Constraint
TableName String No No The name of the table not to be migrated from the source database. None

Response parameters

Fn::GetAtt

MigrationJobId: the ID of the migration task.

Examples

  • YAMLformat

    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
  • JSONformat

    {
      "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"
            ]
          }
        }
      }
    }