Creates a migration task for a source server.

Usage notes

  • You can create migration tasks only for source servers that are in the Available state.
  • Each source server can be associated with only one migration task that is in the Ready, Running, Stopped, Waiting, InError, or Expired state.
  • You can create a maximum of 1,000 migration tasks within each Alibaba Cloud account.
  • If you migrate a source server to an image, you must specify the ImageName, SystemDiskSize, and DataDisk parameters.
  • If you use a virtual private cloud (VPC) to migrate data, the VSwitchId parameter is required and the VpcId parameter is optional.
  • Server Migration Center (SMC) allows you to migrate source servers to Docker container images. This allows you to migrate containerized applications in a cost-effective way.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesCreateReplicationJob

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

RegionIdStringYescn-hangzhou

The ID of the Alibaba Cloud region to which you want to migrate the source server.

For example, if you want to migrate the source server to the China (Hangzhou) region, set this parameter to cn-hangzhou. You can call the DescribeRegions operation to query the latest regions.

ClientTokenStringNo123e4567-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 token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

NameStringNotestMigrationTaskName

The name of the migration task. The 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 (-). The name must start with a letter, but cannot start with http:// or https://.
DescriptionStringNoThis_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 (-). The description must start with a letter, but cannot start with http:// or https://.

SourceIdStringYess-bp1e2fsl57knvuug****

The ID of the source server.

TargetTypeStringNoImage

The type of destination to which you want to migrate the source server. Valid values:

  • Image: After the migration task is complete, SMC generates an Elastic Compute Service (ECS) image for the source server.
  • ContainerImage: After the migration task is complete, SMC generates a Docker container image for the source server.
  • TargetInstance: After the migration task is completed, SMC migrates the source server to the destination instance. If you set this parameter to TargetInstance, you must set the InstanceId parameter.
ScheduledStartTimeStringNo2019-06-04T13:35:00Z

The time when you want to run the migration task. The time must meet the following requirements:

  • The time must be specified in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. For example, 2018-01-01T12:00:00Z specifies 20:00:00 on January 1, 2018 (UTC+8).
  • The value 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 the task is created. You can call the StartReplicationJob operation to start the migration task.
ValidTimeStringNo2019-06-04T13:35:00Z

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

  • The time must be specified in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. For example, 2018-01-01T12:00:00Z specifies 20:00:00 on January 1, 2018 (UTC+8).
  • If you do not specify this parameter, the migration task does not expire.
  • After a migration task expires, the task state changes to Expired. SMC retains the migration task for seven days after the task expires. After the task is retained for seven days, SMC deletes the migration task.

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

ImageNameStringNotestAliCloudImageName

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

  • The name must be unique within an Alibaba Cloud region.
  • The name must be 2 to 128 characters in length, and can contain digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter, 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.
InstanceIdStringNoi-bp1f1dvfto1sigz5****

The ID of the destination ECS instance.

SystemDiskSizeIntegerNo80

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

Note The value must be greater than the used space of the system disk on the source server. For example, if the total size of the source disk is 500 GiB and the used space is 100 GiB, the value of this parameter must be greater than 100 GiB.
VpcIdStringNovpc-bp1vwnn14rqpyiczj****

The ID of a VPC for which you have configured an Express Connect circuit or a VPN gateway.

VSwitchIdStringNovsw-bp1ddbrxdlrcbim46****

The ID of the vSwitch in the specified VPC.

You must set this parameter if you use a VPC to migrate data.

ReplicationParametersStringNo{"bandwidth_limit":0,"compress_level":1,"checksum":true}

The parameters of the replication driver. The parameters must be specified as key-value pairs in the 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 that is used to migrate a source server to an intermediate instance. The parameters vary based on the replication driver type. If you use a Server Migration Tool (SMT) driver, you can specify the following parameters:

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

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

NetModeIntegerNo0

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. If you specify this value, you must specify the VSwitchId parameter. You do not need to specify the VpcId parameter because the value of the VpcId parameter can be retrieved based on the value of the VSwitchId parameter.

Default value: 0

RunOnceBooleanNotrue

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

  • true: creates a migration task that runs only once. This is the default value. Incremental data of the source server is not synchronized.
  • false: creates an incremental migration task. In this case, you must specify the Frequency parameter. SMC synchronizes incremental data of the source server to Alibaba Cloud at the specified frequency. You can use an incremental migration task to synchronize incremental data from the source server to Alibaba Cloud without the need to interrupt your business. A full data image is generated for the source server when the task is running.
Note You can specify this parameter only when you create a migration task. The parameter value cannot be changed after the task is created.
FrequencyIntegerNo12

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

This parameter is required if you set the RunOnce parameter to false.

This parameter is empty by default.

MaxNumberOfImageToKeepIntegerNo10

The maximum number of images retained for the incremental migration task. Valid values: 1 to 10.

This parameter is required if you set the RunOnce parameter to false.

This parameter is empty by default.

InstanceTypeStringNoecs.c6.large

The type of the intermediate instance.

You can call the DescribeInstanceTypes operation to query the ECS instance types.

  • If you specify this parameter, SMC creates an intermediate instance of the specified instance type. If the specified instance type is unavailable, the migration task fails to be created.
  • If you do not specify this parameter, SMC selects an available instance type in a specific order to create an intermediate instance. For more information, see SMC FAQ.
LaunchTemplateIdStringNolt-bp16jovvln1cgaaq****

The ID of the launch template.

LaunchTemplateVersionStringNo1

The version number of the launch template.

InstanceRamRoleStringNoSMCAdmin

The name of the RAM role that is assigned to the instance.

ContainerNamespaceStringNotestNamespace

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

ContainerRepositoryStringNotestRepository

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

ContainerTagStringNoCentOS:v1

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

LicenseTypeStringNoBYOL

The license type. Valid values:

  • An empty value specifies no license.
  • A value of BYOL specifies Bring Your Own License (BYOL).

For more information, see SMC FAQ.

DataDisk.N.IndexIntegerNo1

The index of data disk N 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 the source server has data disks.
DataDisk.N.Part.N.SizeBytesLongNo254803968

The size of partition N in the destination data disk. Unit: bytes. The default value is equal to the corresponding partition size of the source data disk.

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

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

  • true
  • false

Default value: true.

DataDisk.N.Part.N.DeviceStringNo0_1

The device ID of partition N in the destination data disk. The partitions in the destination data disk are arranged in the same sequential order as those in the source data disk.

Note You must set both the DataDisk.N.Part.N.Device and DataDisk.N.Part.N.SizeBytes parameters or leave both parameters empty.
DataDisk.N.SizeIntegerNo100

The size of the 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 size of the source data disk is 500 GiB and the used space is 100 GiB, you must set this parameter to a value greater than 100.
Tag.N.KeyStringNoTestKey

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

The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot start with aliyun, acs:, http://, or https://.

Tag.N.ValueStringNoTestValue

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

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

SystemDiskPart.N.SizeBytesLongNo254803968

The size of the partition N in the destination system disk. Unit: bytes. The default value is equal to the partition size of the source system disk.

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

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

  • true
  • false

Default value: true.

SystemDiskPart.N.DeviceStringNo0_1

The ID of partition N 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 set both the SystemDiskPart.N.Device and SystemDiskPart.N.SizeBytes parameters or leave both parameters empty.
JobTypeIntegerNo0

The type of the migration task. Valid values:

  • 0: server migration
  • 1: operating system migration
  • 2: cross-zone migration
  • 3: agentless migration for a VMware VM
ResourceGroupIdStringNorg-acfmw3ty5y7****

The ID of the resource group.

Response parameters

ParameterTypeExampleDescription
RequestIdStringC8B26B44-0189-443E-9816-D951F59623A9

The ID of the request.

JobIdStringj-bp17bclvg344jlyt****

The ID of the migration task.

Examples

Sample requests

http(s)://smc.aliyuncs.com/?Action=CreateReplicationJob
&RegionId=cn-hangzhou
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&Name=testMigrationTaskName
&Description=This_is_a_migration_task
&SourceId=s-bp1e2fsl57knvuug****
&TargetType=Image
&ScheduledStartTime=2019-06-04T13:35:00Z
&ValidTime=2019-06-04T13:35:00Z
&ImageName=testAliCloudImageName
&InstanceId=i-bp1f1dvfto1sigz5****
&SystemDiskSize=80
&VpcId=vpc-bp1vwnn14rqpyiczj****
&VSwitchId=vsw-bp1ddbrxdlrcbim46****
&ReplicationParameters={"bandwidth_limit":0,"compress_level":1,"checksum":true}
&NetMode=0
&RunOnce=true
&Frequency=12
&MaxNumberOfImageToKeep=10
&InstanceType=ecs.c6.large
&LaunchTemplateId=lt-bp16jovvln1cgaaq****
&LaunchTemplateVersion=1
&InstanceRamRole=SMCAdmin
&ContainerNamespace=testNamespace
&ContainerRepository=testRepository
&ContainerTag=CentOS:v1
&LicenseType=BYOL
&DataDisk=[{"Index":1,"Part":[{"SizeBytes":254803968,"Block":true,"Device":"0_1"}],"Size":100}]
&Tag=[{"Key":"TestKey","Value":"TestValue"}]
&SystemDiskPart=[{"SizeBytes":254803968,"Block":true,"Device":"0_1"}]
&JobType=0
&ResourceGroupId=rg-acfmw3ty5y7****
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HTTP status codeError codeError messageDescription
400SourceServerState.InvalidThe specified source server status is invalid.The error message returned because the migration source is in an invalid status and the operation is not supported.
400ReplicationJobDataDiskIndex.InvalidThe specified replication job contains data disk index not found in source server.The error message returned because the migration task specifies one or more data disk indexes that are not found in the source server.
400VSwitchIdVpcId.MismatchThe specified VSwitchId and VpcId does not match.The error message returned because the specified values of the VSwitchId and VpcId parameters do not match.
400InvalidSecurityGroupId.IncorrectNetworkTypeThe 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.
400InvalidSecurityGroupId.VPCMismatchThe 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.
400QuotaExceeded.ReplicationJobThe 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 was reached. Submit a ticket to request a quota increase.
400ReplicationJobName.DuplicateThe specified replication job name already exists.The error message returned because the specified migration task name already exists. Specify another name for the migration task.
500InternalErrorAn 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 had occurred. Try again later. If the error persists, submit a ticket.

For a list of error codes, see Service error codes.