You can call this operation to create a migration task for a source server.

Notes

  • You can create migration tasks for source servers that are in the Active state.
  • You can create one migration task for each source server. If the migration task of a source server is unfinished, you cannot create a new migration task for the source server. A migration task is unfinished if the task is in the Ready, Running, Stopped, Waiting, InError, or Expired state.
  • You can create a maximum of 100 migration tasks under each Alibaba Cloud account.
  • If you migrate a source server to a destination image, you must specify the ImageName, SystemDiskSize, and DataDisk parameters.
  • If you use a virtual private cloud (VPC) to migrate data, you must specify the VSwitchId parameter and choose whether to specify the VpcId parameter.
  • SMC allows you to migrate source servers to Docker container images. You can use SMC to migrate containerized applications to Container Registry at low costs.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateReplicationJob

The operation that you want to perform. Set the value to CreateReplicationJob.

RegionId String Yes cn-hangzhou

The ID of the destination Alibaba Cloud region.

For example, if you want to migrate the source server to Shanghai, set the value to cn-shanghai. You can call DescribeRegionsto query the latest list of Alibaba Cloud regions.

SourceId String Yes s-bp1e2fsl57knvuug****

The ID of the source server.

SystemDiskSize Integer Yes 80

The system disk size of the destination ECS instance. Unit: GiB. Valid values: 20 to 500.

Note The size of the destination system disk must be larger than the size of data in the source system disk. For example, if the total size of the source system disk is 500 GiB and the size of existing data is 100 GiB, you must set this parameter to a value greater than 100 GiB.
ClientToken String No 123e4567-e89b-12d3-a456-426655440000

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value. The token can contain ASCII characters only and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

Name String No MigrationTaskName

The name of the migration task. The migration task name must meet the following requirements:

  • The name must be unique.
  • The name must be 2 to 128 characters in length, and can contain digits, colons (:), underscores (_), and hyphens (-). It must start with a letter or a Chinese character, but cannot start with http:// or https://.
Description String No This_is_a_migration_task

The description of the migration task.

The description must be 2 to 128 characters in length, and can contain digits, colons (:), underscores (_), and hyphens (-). It must start with a letter or a Chinese character, but cannot start with http:// or https://.

TargetType String No Image

The type of the destination image. Valid values:

  • Image: After the migration task is complete, SMC generates a destination ECS image for the source server.
  • ContainerImage: After the migration task is complete, SMC generates a destination Docker container image for the source server.
ScheduledStartTime String No 2019-06-04T13:35:00Z

The time when the migration is performed. This parameter must meet the following requirements:

  • Specify the time in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. Use the UTC+0 time zone. For example, 2018-01-01T12:00:00Z indicates 20:00:00 on January 1, 2018 (UTC+8).
  • The time must be within 30 days after the current time.
Note If you do not specify this parameter, you must manually start the migration task after it is created. You can call StartReplicationJob to start the migration task.
ValidTime String No 2019-06-04T13:35:00Z

The time when the migration task expires. You can schedule the migration task to expire seven to 90 days after the task is created.

  • Specify the time in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. Use the UTC+0 time zone. For example, 2018-01-01T12:00:00Z indicates 20:00:00 on January 1, 2018 (UTC+8).
  • If this parameter is not specified, the migration task does not expire.
  • When a migration task expires, the task enters the Expired state. SMC retains the migration task for seven days after the task expires. After the retention period, SMC automatically deletes the migration task.

By default, a migration task is valid within 30 days after it is created.

ImageName String No MyAliCloudImage

The name of the destination image. The destination image name must meet the following requirements:

  • The name must be unique in the destination region.
  • The name must be 2 to 128 characters in length, and can contain digits, colons (:), underscores (_), and hyphens (-). It must start with a letter or a Chinese character, but cannot start with http:// or https://.
Note If you specify an image name that already exists in the destination region, the migration task ID is appended to the image name as a suffix. Example: ImageName_j-2zexxxxxxxxxxxxx.
InstanceId String No i-bp1f1dvfto1sigz5****

The ID of the destination ECS instance.

DataDisk.N.Size Integer No 100

The size of a data disk on the destination ECS instance. Unit: GiB. Valid values: 20 to 32768.

Note The size of a destination data disk must be larger than the size of data in the source data disk. For example, if the total size of a source data disk is 500 GiB but the size of existing data is 100 GiB, you must set this parameter to a value greater than 100 GiB.
DataDisk.N.Index Integer No 1

The serial number of a data disk on the destination ECS instance. Data disks on a destination ECS instance are arranged in a sequential order that starts from 1. Valid values: 1 to 16.

Note To create a destination data disk for a source server, make sure that this source server has data disks.
DataDisk.N.Part.N.Device String No 0_1

The ID of a partition in a destination data disk. Each destination data disk corresponds to a source data disk. The partitions in a destination data disk are arranged in the same sequential order as those in the corresponding source data disk.

Note You must specify both the DataDisk.N.Part.N.Device and DataDisk.N.Part.N.SizeBytes parameters or leave both parameters empty.
DataDisk.N.Part.N.SizeBytes Long No 254803968

The size of a partition in a destination data disk. Unit: bytes. By default, the source and destination data disks use the same partitioning scheme.

Note
  • The total size of all partitions in a destination data disk cannot exceed the size of the destination data disk.
  • You must specify both the DataDisk.N.Part.N.Device and DataDisk.N.Part.N.SizeBytes parameters or leave both parameters empty.
DataDisk.N.Part.N.Block Boolean No true

Specifies whether to enable block replication for a partition in a destination data disk. Valid values:

  • true
  • false

Default value: true.

Tag.N.Key String No usage

The key of a tag for the migration task. Valid values of N: 1 to 20.

You cannot enter an empty string as the parameter value. The key can be up to 128 characters in length, and cannot start with aliyun, acs:, http://, or https://.

Tag.N.Value String No production

The value of a tag for the migration task. Valid values of N: 1 to 20.

You can enter an empty string as the parameter value. The value can be up to 128 characters in length, and cannot start with aliyun, acs:, http://, or https://.

VpcId String No vpc-bp1vwnn14rqpyiczj****

The ID of the VPC. The specified VPC must have Express Connect or VPN Gateway configured.

VSwitchId String No vsw-bp1ddbrxdlrcbim46****

The ID of the VSwitch in the specified VPC.

This parameter is required if you use a VPC to migrate data.

ReplicationParameters String No {"bandwidth_limit":0,"compress_level":1,"checksum":true}

A string of key-value pairs for configuring the replication driver. The parameters must be specified as key-value pairs in JSON format. The keys are fixed for each type of replication driver. The JSON string can be up to 2,048 characters in length.

A replication driver is a tool used for migrating a source server to an intermediate instance. The parameters vary based on the replication driver type. If you use an SMT driver, you can configure the following parameters:

  • bandwidth_limit: the maximum bandwidth for data transmission.
  • compress_level: the compression ratio of data to be migrated.
  • checksum: specifies whether to enable checksum verification.

For more information about replication drivers, see response parameter ReplicationDriver in the DescribeSourceServers operation.

NetMode Integer No 0

The network mode for data transmission. Valid values:

  • 0: Data is transmitted over the Internet. Make sure that the source server can access the Internet.
  • 2: Data is transmitted over a VPC. You must specify the VSwitchId parameter. You can call an API operation to query the value of the VpcId parameter based on the VSwitchId parameter. Therefore, you do not have to specify the VpcId parameter.

Default value: 0.

RunOnce Boolean No true

Specifies whether to disable incremental migration for the source server. Default value: true. Valid values:

  • true: disables incremental migration. Incremental data of the source server is not synchronized.
  • false: enables incremental migration. You must specify the Frequency parameter. SMC automatically synchronizes incremental data of the source server to Alibaba Cloud at the specified frequency. SMC can synchronize incremental data from the source server to Alibaba Cloud without interrupting your business. SMC generates a full data image for the source server when the migration task is running.
Note You can specify this parameter only when you create a migration task. The value cannot be modified after it is specified.
Frequency Integer No 12

The interval at which SMC automatically synchronizes incremental data to Alibaba Cloud. Unit: hours. Valid values: 1 to 168.

This parameter is required if you set RunOnce to false.

By default, this parameter is not specified.

MaxNumberOfImageToKeep Integer No 10

The maximum number of images that can be retained during incremental migration. Valid values: 1 to 10.

This parameter is required if you set RunOnce to false.

By default, this parameter is not specified.

InstanceType String No ecs.c6.large

The type of the intermediate instance.

You can call DescribeInstanceTypes to query the ECS instance types.

  • If you specify this parameter, SMC creates an intermediate instance of the specified type. If the specified instance type is unavailable, you cannot create the migration task.
  • If you do not specify this parameter, SMC selects an instance type from available options arranged in a specific order to create an intermediate instance. For more information about available intermediate instance types, see SMC FAQ.
SystemDiskPart.N.Device String No 0_1

The ID of a partition in the destination system disk. The partitions in the destination system disk are arranged in the same sequential order as those in the source system disk.

Note You must specify both the SystemDiskPart.N.Device and SystemDiskPart.N.SizeBytes parameters or leave both parameters empty.
SystemDiskPart.N.SizeBytes Long No 254803968

The size of a partition in the destination system disk. Unit: bytes. By default, the source and destination system disks use the same partitioning scheme.

Note
  • The total size of all partitions in the destination system disk cannot exceed the size of the destination system disk.
  • You must specify both the SystemDiskPart.N.Device and SystemDiskPart.N.SizeBytes parameters or leave both parameters empty.
SystemDiskPart.N.Block Boolean No true

Specifies whether to enable block replication for a partition in the destination system disk. Valid values:

  • true
  • false

Default value: true.

InstanceRamRole String No SMCAdmin

The RAM role that is attached to the intermediate instance.

ContainerNamespace String No testNamespace

The namespace of the destination Docker container image. For more information about Docker container images, see Container Registry.

ContainerRepository String No testRepository

The repository that stores the destination Docker container image. For more information about Docker container images, see Container Registry.

ContainerTag String No CentOS:v1

The tag of the destination Docker container image. For more information about Docker container images, see Container Registry.

Response parameters

Parameter Type Example Description
JobId String j-bp17bclvg344jlyt****

The ID of the migration task.

RequestId String C8B26B44-0189-443E-9816-D951F59623A9

The ID of the request.

Examples

Sample requests

http(s)://smc.aliyuncs.com/? Action=CreateReplicationJob
&RegionId=cn-hangzhou
&SourceId=s-bp1e2fsl57knvuug****
&SystemDiskSize=80
&<Common request parameters>

Sample success responses

XML format

<CreateReplicationJobResponse>
    <JobId>j-bp17bclvg344jlyt****</JobId>
    <RequestId>C8B26B44-0189-443E-9816-D951F59623A9</RequestId>
</CreateReplicationJobResponse>

JSON format

{
    "JobId": "j-bp17bclvg344jlyt****",
    "RequestId": "C8B26B44-0189-443E-9816-D951F59623A9"
}

Error codes

HttpCode Error code Error message Description
400 SourceServerState.Invalid The specified source server status is invalid. The error message returned because the operation is not supported while the source server is in the current state.
400 ReplicationJobDataDiskIndex.Invalid The specified replication job contains data disk index not found in source server. The error message returned because the migration task involves a data disk serial number that does not exist in the source server.
400 VSwitchIdVpcId.Mismatch The specified VSwitchId and VpcId does not match. The error message returned because the specified VSwitchId and VpcId do not match.
400 InvalidSecurityGroupId.IncorrectNetworkType The network type of the specified security group does not support this action. The error message returned because the operation is not supported by the network type of the security group.
400 InvalidSecurityGroupId.VPCMismatch The specified security group and the specified virtual switch are not in the same VPC. The error message returned because the specified security group and VSwitch are not connected to the same VPC.
400 QuotaExceeded.ReplicationJob The maximum number of replication jobs is exceeded. Please submit a ticket to raise the quota. The error message returned because the maximum number of migration tasks is exceeded. Submit a ticket to raise the quota.
400 ReplicationJobName.Duplicate The specified replication job name already exists. The error message returned because the specified migration task name already exists. Modify the migration task name.
500 InternalError An error occurred while processing your request. Please try again. If the problem still exists, please submit a ticket. The error message returned because an internal error occurred. Try again later. If the problem persists, submit a ticket.

For a list of error codes, visit the API Error Center.