Creates a migration task for a source server.
Operation description
Description
You can create migration tasks only for source servers that are in the Available state.
A source server can be associated with only one migration task in an incomplete state, such as Ready, Running, Stopped, Waiting, InError, or Expired.
Each Alibaba Cloud account can create up to 1,000 migration tasks.
If the migration target is an image, the ImageName, SystemDiskSize, and DataDisk parameters are required.
For migrations over a VPC internal network, the VSwitchId parameter is required and the VpcId parameter is optional.
You can migrate a source server to a Docker container image for low-cost application containerization.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
smc:CreateReplicationJob |
create |
*ReplicationJob
*SourceServer
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The ID of the destination Alibaba Cloud region. For example, if you want to migrate a source server to the China (Hangzhou) region, set this parameter to |
cn-hangzhou |
| ClientToken |
string |
No |
A client token to ensure the idempotence of the request. Generate a string of up to 64 ASCII characters and assign it to this parameter. For more information, see How to ensure idempotence. |
123e4567-e89b-12d3-a456-426655440000 |
| Name |
string |
No |
The name of the migration task. The name must meet the following requirements:
|
testMigrationTaskName |
| Description |
string |
No |
The description of the migration task. The description must be 2 to 128 characters in length. It must start with a letter or a Chinese character. It cannot start with |
This_is_a_migration_task |
| SourceId |
string |
Yes |
The ID of the migration source. |
s-bp1e2fsl57knvuug**** |
| TargetType |
string |
No |
The type of the migration target. Valid values:
|
Image |
| ScheduledStartTime |
string |
No |
The time when you want to start the migration task. The time must meet the following requirements:
Note
If you leave this parameter empty, the migration task is not automatically started. You must call the StartReplicationJob operation to start the task. |
2019-06-04T13:35:00Z |
| ValidTime |
string |
No |
The time when the migration task expires. The value must be between 7 and 90 days after the task is created.
Default value: 30 days after the task is created. |
2019-06-04T13:35:00Z |
| ImageName |
string |
No |
The name of the destination Alibaba Cloud image. The name must meet the following requirements:
Note
If an image with the same name already exists in the current region when the migration task is running, the system adds the migration task ID (JobId) to the image name as a suffix. For example: `ImageName_j-2zexxxxxxxxxxxxx`. |
testAliCloudImageName |
| InstanceId |
string |
No |
The ID of the destination instance. |
i-bp1f1dvfto1sigz5**** |
| SystemDiskSize |
integer |
No |
The system disk size of the destination Elastic Compute Service (ECS) instance. Unit: GiB. Valid values: 20 to 2048. Note
The value must be greater than the used space of the source system disk. For example, if the source system disk is 500 GiB and 100 GiB of space is used, set this parameter to a value greater than 100. |
80 |
| VpcId |
string |
No |
The ID of the VPC that is configured with an Express Connect circuit or a VPN Gateway. |
vpc-bp1vwnn14rqpyiczj**** |
| VSwitchId |
string |
No |
The ID of the virtual switch in the specified VPC. This parameter is required for migrations over a VPC internal network. |
vsw-bp1ddbrxdlrcbim46**** |
| ReplicationParameters |
string |
No |
The parameters for the replication driver. The parameters are a JSON key-value pair. The keys are fixed. The value can be up to 2,048 characters in length. The replication driver is the tool used to copy data from the source server to the intermediate instance. The supported parameters vary based on the replication driver. The SMT replication driver supports the following parameters:
To obtain the value of the replication driver, see the |
{"bandwidth_limit":0,"compress_level":1,"checksum":true} |
| NetMode |
integer |
No |
The network mode for data transmission. Valid values:
Default value: 0. |
0 |
| RunOnce |
boolean |
No |
Specifies whether to create a one-time migration task or an incremental migration task. Valid values:
Note
You can specify this parameter only when you create a migration task. You cannot change the value after the task is created. |
true |
| Frequency |
integer |
No |
The interval at which an incremental migration task is run. Unit: hours. Valid values: 1 to 168. This parameter is required if you set the Default value: None. |
12 |
| MaxNumberOfImageToKeep |
integer |
No |
The maximum number of images to retain for an incremental migration task. Valid values: 1 to 10. This parameter is required if you set the Default value: None. |
10 |
| InstanceType |
string |
No |
The instance type of the intermediate instance. You can call the DescribeInstanceTypes operation to query the instance types provided by ECS.
|
ecs.c6.large |
| LaunchTemplateId |
string |
No |
The ID of the launch template. |
lt-bp16jovvln1cgaaq**** |
| LaunchTemplateVersion |
string |
No |
The version of the launch template. |
1 |
| InstanceRamRole |
string |
No |
The name of the RAM role for the instance. |
SMCAdmin |
| ContainerNamespace |
string |
No |
The namespace of the Docker container. For more information, see Container Registry. |
testNamespace |
| ContainerRepository |
string |
No |
The image repository for the Docker container. For more information, see Container Registry. |
testRepository |
| ContainerTag |
string |
No |
The image tag for the Docker container. For more information, see Container Registry. |
CentOS:v1 |
| LicenseType |
string |
No |
The license type. Valid values:
For more information, see SMC FAQ. |
BYOL |
| DataDisk |
array<object> |
No |
The list of data disks. |
|
|
array<object> |
No |
The list of data disks. |
||
| Index |
integer |
No |
The sequence number of the data disk on the destination ECS instance. The sequence starts from 1. Valid values: 1 to 16. Note
You can create a destination data disk only for a data disk that exists on the migration source. |
1 |
| Part |
array<object> |
No |
The list of partitions. |
|
|
object |
No |
The list of partitions. |
||
| SizeBytes |
integer |
No |
The size of partition N on data disk N. Unit: bytes. Default value: the size of the source data disk partition. Note
|
254803968 |
| Block |
boolean |
No |
Specifies whether to enable block replication for partition N on data disk N. Valid values:
Default value: `true`. |
true |
| Device |
string |
No |
The device ID of partition N on data disk N. The value of N must be the same as the value of N in the device ID of the source partition. Note
This parameter cannot be empty if |
0_1 |
| Size |
integer |
No |
The size of the data disk on the destination ECS instance. Unit: GiB. Valid values: 20 to 32768. Note
The value must be greater than the used space of the source data disk. For example, if the source data disk is 500 GiB and 100 GiB of space is used, set this parameter to a value greater than 100. |
100 |
| Tag |
array<object> |
No |
The list of tags. |
|
|
object |
No |
The list of tags. |
||
| Key |
string |
No |
The key of tag N for the migration task. Valid values of N: 1 to 20. The tag key cannot be an empty string. It can be up to 128 characters in length. It cannot start with |
TestKey |
| Value |
string |
No |
The value of tag N for the migration task. Valid values of N: 1 to 20. The tag value can be an empty string. It can be up to 128 characters in length. It cannot start with |
TestValue |
| SystemDiskPart |
array<object> |
No |
The information about the system disk partitions. |
|
|
object |
No |
The list of system disk partitions. |
||
| SizeBytes |
integer |
No |
The size of system disk partition N. Unit: bytes. Default value: the size of the source system disk partition. Note
|
254803968 |
| Block |
boolean |
No |
Specifies whether to enable block replication for system disk partition N. Valid values:
Default value: `true`. |
true |
| Device |
string |
No |
The device ID of system disk partition N. The value of N must be the same as the value of N in the device ID of the source partition. Note
This parameter cannot be empty if |
0_1 |
| JobType |
integer |
No |
The type of the migration task. Valid values:
|
0 |
| ResourceGroupId |
string |
No |
The ID of the resource group. |
rg-acfmw3ty5y7**** |
| Disks |
object |
No |
The disk information. |
|
| System |
object |
No |
The system disk information. |
|
| Size |
integer |
No |
The size of the source system disk. Unit: GiB. Valid values: 20 to 32768. Note
The value must be greater than the used space of the source system disk. For example, if the source system disk is 500 GiB and 100 GiB of space is used, set this parameter to a value greater than 100. |
100 |
| LVM |
boolean |
No |
Specifies whether to use Logical Volume Management (LVM). Valid values:
LVM is not supported in the following scenarios:
If you enable LVM, the feature does not take effect in the following scenarios:
|
true |
| Part |
array<object> |
No |
The information about the system disk partitions. |
|
|
object |
No |
The information about the system disk partitions. |
||
| SizeBytes |
integer |
No |
The size of the system disk partition. Unit: bytes. |
254803968 |
| Block |
boolean |
No |
Specifies whether to enable block replication for the system disk partition. |
true |
| Path |
string |
No |
The path of the system disk partition. |
/boot |
| Data |
array<object> |
No |
The information about the data disk partitions. |
|
|
array<object> |
No |
The information about the data disk partitions. |
||
| Size |
integer |
No |
The size of the source data disk. Unit: GiB. |
80 |
| LVM |
boolean |
No |
Specifies whether to use LVM for the data disk. Valid values:
|
|
| DiskId |
string |
No |
The ID of the data disk. |
d-2ze8hyowhdgd6ou2m5z6 |
| Part |
array<object> |
No |
The information about the data disk partitions. |
|
|
object |
No |
The information about the data disk partitions. |
||
| SizeBytes |
integer |
No |
The size of the data disk partition. Unit: bytes. |
21474836480 |
| Block |
boolean |
No |
Specifies whether to enable block replication for the data disk partition. Valid values:
|
true |
| Path |
string |
No |
The path of the data disk partition. |
/home/date |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The request ID. |
C8B26B44-0189-443E-9816-D951F59623A9 |
| JobId |
string |
The ID of the migration task. |
j-bp17bclvg344jlyt**** |
Examples
Success response
JSON format
{
"RequestId": "C8B26B44-0189-443E-9816-D951F59623A9",
"JobId": "j-bp17bclvg344jlyt****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | ReplicationJobDataDiskIndex.Invalid | The specified replication job contains data disk index not found in source server. | The specified replication job contains data disk indexes that do not exist in the source server. |
| 400 | VSwitchIdVpcId.Mismatch | The specified VSwitchId and VpcId does not match. | The specified VSwitchId and VpcId does not match. |
| 400 | InvalidSecurityGroupId.IncorrectNetworkType | The network type of the specified security group does not support this action. | The network type of the specified security group does not support this action. |
| 400 | InvalidSecurityGroupId.VPCMismatch | The specified security group and the specified virtual switch are not in the same VPC. | The specified security group and the specified virtual switch are not in the same VPC. |
| 400 | QuotaExceeded.ReplicationJob | The maximum number of replication jobs is exceeded. Please submit a ticket to raise the quota. | The maximum number of replication jobs is exceeded. Please submit a ticket to raise the quota. |
| 400 | ReplicationJobName.Duplicate | The specified replication job name already exists. | The specified replication job name already exists. |
| 400 | SourceServerState.Invalid | The specified source server status: %s is invalid. This operation can only be performed in the following status: %s. | The specified source server status: %s is invalid. This operation can only be performed in the following status: %s. |
| 400 | ImageName.UsedByReplicationJob | The specified imageName: "%s" was used by another replication job in the current region. | The specified imageName: "%s" was used by another replication job in the current region. |
| 400 | InvalidOsMigrationType.NotMatched | The SourceOsType: %s and TargetOsType: %s are not matched. The supported TargetOsType list is: %s. | The SourceOsType: %s and TargetOsType: %s are not matched. The supported TargetOsType list is: %s. |
| 500 | InternalError | An error occurred while processing your request. Please try again. If the problem still exists, please submit a ticket. | An error occurred while processing your request. Please try again. If the problem still exists, please submit a ticket. |
| 403 | EntityNotExist.Role | The account is unauthorized. Please assign the role AliyunServiceRoleForSMC to your account. | The account does not have the operation permission, please assign the account AliyunServiceRoleForSMC role. |
| 403 | RealNameAuthenticationError | You must perform real-name verification for your account. | The account does not have real-name authentication. Please perform real-name authentication first. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.