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
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 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 |
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 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. |
Name | String | No | testMigrationTaskName | The name of the migration task. The name must meet the following requirements:
|
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 (-). The description must start with a letter, but cannot start with |
SourceId | String | Yes | s-bp1e2fsl57knvuug**** | The ID of the source server. |
TargetType | String | No | Image | The type of destination to which you want to migrate the source server. Valid values:
|
ScheduledStartTime | String | No | 2019-06-04T13:35:00Z | The time when you want to run the migration task. The time must meet the following requirements:
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. |
ValidTime | String | No | 2019-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.
By default, a migration task is valid for 30 days after it is created. |
ImageName | String | No | testAliCloudImageName | The name of the destination image. The name must meet the following requirements:
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. |
SystemDiskSize | Integer | No | 80 | 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. |
VpcId | String | No | vpc-bp1vwnn14rqpyiczj**** | The ID of a VPC for which you have configured an Express Connect circuit or a VPN gateway. |
VSwitchId | String | No | vsw-bp1ddbrxdlrcbim46**** | The ID of the vSwitch in the specified VPC. You must set this parameter if you use a VPC to migrate data. |
ReplicationParameters | String | No | {"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:
For more information about replication drivers, see the response parameter |
NetMode | Integer | No | 0 | The network mode for data transmission. Valid values:
Default value: 0 |
RunOnce | Boolean | No | true | Specifies whether to disable incremental migration for the source server. Valid values:
Note You can specify this parameter only when you create a migration task. The parameter value cannot be changed after the task is created. |
Frequency | Integer | No | 12 | 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 This parameter is empty by default. |
MaxNumberOfImageToKeep | Integer | No | 10 | The maximum number of images retained for the incremental migration task. Valid values: 1 to 10. This parameter is required if you set the This parameter is empty by default. |
InstanceType | String | No | ecs.c6.large | The type of the intermediate instance. You can call the DescribeInstanceTypes operation to query the ECS instance types.
|
LaunchTemplateId | String | No | lt-bp16jovvln1cgaaq**** | The ID of the launch template. |
LaunchTemplateVersion | String | No | 1 | The version number of the launch template. |
InstanceRamRole | String | No | SMCAdmin | The name of the RAM role that is assigned to the instance. |
ContainerNamespace | String | No | testNamespace | The namespace of the destination Docker container image. For more information about Docker container images, see Terms. |
ContainerRepository | String | No | testRepository | The repository that stores the destination Docker container image. For more information about Docker container images, see Terms. |
ContainerTag | String | No | CentOS:v1 | The tag of the destination Docker container image. For more information about Docker container images, see Terms. |
LicenseType | String | No | BYOL | The license type. Valid values:
For more information, see SMC FAQ. |
DataDisk.N.Index | Integer | No | 1 | 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.SizeBytes | Long | No | 254803968 | 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
|
DataDisk.N.Part.N.Block | Boolean | No | true | Specifies whether to enable block replication for partition N in the destination data disk. Valid values:
Default value: true. |
DataDisk.N.Part.N.Device | String | No | 0_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.Size | Integer | No | 100 | 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.Key | String | No | TestKey | 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 |
Tag.N.Value | String | No | TestValue | 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 |
SystemDiskPart.N.SizeBytes | Long | No | 254803968 | 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
|
SystemDiskPart.N.Block | Boolean | No | true | Specifies whether to enable block replication for partition N in the destination system disk. Valid values:
Default value: true. |
SystemDiskPart.N.Device | String | No | 0_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. |
JobType | Integer | No | 0 | The type of the migration task. Valid values:
|
ResourceGroupId | String | No | rg-acfmw3ty5y7**** | The ID of the resource group. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | C8B26B44-0189-443E-9816-D951F59623A9 | The ID of the request. |
JobId | String | j-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 code | Error code | Error message | Description |
---|---|---|---|
400 | SourceServerState.Invalid | The 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. |
400 | ReplicationJobDataDiskIndex.Invalid | The 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. |
400 | VSwitchIdVpcId.Mismatch | The specified VSwitchId and VpcId does not match. | The error message returned because the specified values of the VSwitchId and VpcId parameters 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 was reached. Submit a ticket to request a quota increase. |
400 | ReplicationJobName.Duplicate | The 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. |
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 had occurred. Try again later. If the error persists, submit a ticket. |
For a list of error codes, see Service error codes.