Creates a migration job for a source server.
Operation description
Usage notes
- You can create migration jobs only for source servers that are in the Available state.
- Each source server can be associated with only one migration job that is in the Ready, Running, Stopped, Waiting, InError, or Expired state.
- You can create a maximum of 1,000 migration jobs 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.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
smc:CreateReplicationJob | create |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | 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 |
ClientToken | string | No | 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. | 123e4567-e89b-12d3-a456-426655440000 |
Name | string | No | The name of the migration job. The name must meet the following requirements:
| testMigrationTaskName |
Description | string | No | The description of the migration job. 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 | This_is_a_migration_task |
SourceId | string | Yes | The ID of the source server. | s-bp1e2fsl57knvuug**** |
TargetType | string | No | The type of destination to which you want to migrate the source server. Valid values:
| Image |
ScheduledStartTime | string | No | The time when you want to run the migration job. The time must meet the following requirements:
Note
If you do not specify this parameter, you must manually start the migration job after the job is created. You can call the StartReplicationJob operation to start the migration job.
| 2019-06-04T13:35:00Z |
ValidTime | string | No | The time when the migration job expires. You can schedule the migration job to expire 7 to 90 days after the job is created.
By default, a migration job is valid for 30 days after it is created. | 2019-06-04T13:35:00Z |
ImageName | string | No | 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 job ID is appended to the image name as a suffix. Example: ImageName_j-2zexxxxxxxxxxxxx.
| testAliCloudImageName |
InstanceId | string | No | The ID of the destination ECS instance. | i-bp1f1dvfto1sigz5**** |
SystemDiskSize | integer | No | 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.
| 80 |
VpcId | string | No | The ID of a VPC for which you have configured an Express Connect circuit or a VPN gateway. | vpc-bp1vwnn14rqpyiczj**** |
VSwitchId | string | No | The ID of the vSwitch in the specified VPC. You must set this parameter if you use a VPC to migrate data. | vsw-bp1ddbrxdlrcbim46**** |
ReplicationParameters | string | No | 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 | {"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 disable incremental migration for the source server. Valid values:
Note
You can specify this parameter only when you create a migration job. The parameter value cannot be changed after the migration job is created.
| true |
Frequency | integer | No | The interval at which SMC synchronizes incremental data to Alibaba Cloud. Unit: hour. Valid values: 1 to 168. This parameter is required if you set the By default, this parameter is empty. | 12 |
MaxNumberOfImageToKeep | integer | No | The maximum number of images retained for the incremental migration job. Valid values: 1 to 10. This parameter is required if you set the By default, this parameter is empty. | 10 |
InstanceType | string | No | The type of the intermediate instance. You can call the DescribeInstanceTypes operation to obtain the ECS instance types.
| ecs.c6.large |
LaunchTemplateId | string | No | The ID of the launch template. | lt-bp16jovvln1cgaaq**** |
LaunchTemplateVersion | string | No | The version number of the launch template. | 1 |
InstanceRamRole | string | No | The name of the Resource Access Management (RAM) role that is assigned to the instance. | SMCAdmin |
ContainerNamespace | string | No | The namespace of the destination Docker container image. For more information about Docker container images, see Terms . | testNamespace |
ContainerRepository | string | No | The repository that stores the destination Docker container image. For more information about Docker container images, see Terms . | testRepository |
ContainerTag | string | No | The tag of the destination Docker container image. For more information about Docker container images, see Terms . | CentOS:v1 |
LicenseType | string | No | The license type. Valid values:
For more information, see SMC FAQ. | BYOL |
DataDisk | array<object> | No | The data disks. | |
object | No | The data disks. | ||
Index | integer | No | 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.
| 1 |
Part | array<object> | No | The data disk partitions. | |
object | No | Partition information of data disk. | ||
SizeBytes | long | No | 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
| 254803968 |
Block | boolean | No | Specifies whether to enable block replication for partition N in the destination data disk. Valid values:
Default value: true | true |
Device | string | No | 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.
| 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 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.
| 100 |
Tag | array<object> | No | The tags. | |
object | No | The tags list. | ||
Key | string | No | The key of the tag for the migration job. 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 | TestKey |
Value | string | No | The value of the tag for the migration job. 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 | TestValue |
SystemDiskPart | array<object> | No | The information about system disk partitions. | |
object | No | Partition information of system disk. | ||
SizeBytes | long | No | 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
| 254803968 |
Block | boolean | No | Specifies whether to enable block replication for partition N in the destination system disk. Valid values:
Default value: true | true |
Device | string | No | 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.
| 0_1 |
JobType | integer | No | The type of the migration job. Valid values:
| 0 |
ResourceGroupId | string | No | The ID of the resource group. | rg-acfmw3ty5y7**** |
Response parameters
Examples
Sample success responses
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. |
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. |
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. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-09-27 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2024-03-28 | The Error code has changed | View Change Details |