All Products
Search
Document Center

Server Migration Center:CreateReplicationJob

Last Updated:Oct 29, 2024

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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
smc:CreateReplicationJobcreate
  • ReplicationJob
    acs:smc:{#regionId}:{#accountId}:replicationjob/*
  • SourceServer
    acs:smc:{#regionId}:{#accountId}:sourceserver/{#SourceServerId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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.

cn-hangzhou
ClientTokenstringNo

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
NamestringNo

The name of the migration job. 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://.
testMigrationTaskName
DescriptionstringNo

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 http:// or https://.

This_is_a_migration_task
SourceIdstringYes

The ID of the source server.

s-bp1e2fsl57knvuug****
TargetTypestringNo

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

  • Image: After the migration job is complete, SMC generates an Elastic Compute Service (ECS) image for the source server.
  • ContainerImage: After the migration job is complete, SMC generates a Docker container image for the source server.
  • TargetInstance: After the migration job is completed, SMC migrates the source server to the destination instance. If you set this parameter to TargetInstance, you must set the InstanceId parameter.
Image
ScheduledStartTimestringNo

The time when you want to run the migration job. 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 job after the job is created. You can call the StartReplicationJob operation to start the migration job.
2019-06-04T13:35:00Z
ValidTimestringNo

The time when the migration job expires. You can schedule the migration job to expire 7 to 90 days after the job 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 job does not expire.
  • After a migration job expires, the job state changes to Expired. SMC retains the migration job for seven days after the job expires. After the job is retained for seven days, SMC deletes the migration job.

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

2019-06-04T13:35:00Z
ImageNamestringNo

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 job ID is appended to the image name as a suffix. Example: ImageName_j-2zexxxxxxxxxxxxx.
testAliCloudImageName
InstanceIdstringNo

The ID of the destination ECS instance.

i-bp1f1dvfto1sigz5****
SystemDiskSizeintegerNo

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
VpcIdstringNo

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

vpc-bp1vwnn14rqpyiczj****
VSwitchIdstringNo

The ID of the vSwitch in the specified VPC.

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

vsw-bp1ddbrxdlrcbim46****
ReplicationParametersstringNo

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.

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

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

0
RunOncebooleanNo

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

  • true: creates a migration job that runs only once. This is the default value. Incremental data of the source server is not synchronized.
  • false: creates an incremental migration job. 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 job 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 job is running.
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
FrequencyintegerNo

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 RunOnce parameter to false.

By default, this parameter is empty.

12
MaxNumberOfImageToKeepintegerNo

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

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

By default, this parameter is empty.

10
InstanceTypestringNo

The type of the intermediate instance.

You can call the DescribeInstanceTypes operation to obtain 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, you cannot create the migration job.
  • 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.
ecs.c6.large
LaunchTemplateIdstringNo

The ID of the launch template.

lt-bp16jovvln1cgaaq****
LaunchTemplateVersionstringNo

The version number of the launch template.

1
InstanceRamRolestringNo

The name of the Resource Access Management (RAM) role that is assigned to the instance.

SMCAdmin
ContainerNamespacestringNo

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

testNamespace
ContainerRepositorystringNo

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

testRepository
ContainerTagstringNo

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

CentOS:v1
LicenseTypestringNo

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.

BYOL
DataDiskarray<object>No

The data disks.

objectNo

The data disks.

IndexintegerNo

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
Partarray<object>No

The data disk partitions.

objectNo

Partition information of data disk.

SizeByteslongNo

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.

254803968
BlockbooleanNo

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

  • true
  • false

Default value: true

true
DevicestringNo

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
SizeintegerNo

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
Tagarray<object>No

The tags.

objectNo

The tags list.

KeystringNo

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 aliyun, acs:, http://, or https://.

TestKey
ValuestringNo

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 aliyun, acs:, http://, or https://.

TestValue
SystemDiskPartarray<object>No

The information about system disk partitions.

objectNo

Partition information of system disk.

SizeByteslongNo

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.

254803968
BlockbooleanNo

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

  • true
  • false

Default value: true

true
DevicestringNo

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
JobTypeintegerNo

The type of the migration job. Valid values:

  • 0: server migration.
  • 1: operating system migration.
  • 2: cross-zone migration.
  • 3: agentless migration for a VMware VM.
0
ResourceGroupIdstringNo

The ID of the resource group.

rg-acfmw3ty5y7****

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

C8B26B44-0189-443E-9816-D951F59623A9
JobIdstring

The ID of the migration job.

j-bp17bclvg344jlyt****

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400ReplicationJobDataDiskIndex.InvalidThe 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.
400VSwitchIdVpcId.MismatchThe specified VSwitchId and VpcId does not match.The specified VSwitchId and VpcId does not match.
400InvalidSecurityGroupId.IncorrectNetworkTypeThe 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.
400InvalidSecurityGroupId.VPCMismatchThe 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.
400QuotaExceeded.ReplicationJobThe 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.
400ReplicationJobName.DuplicateThe specified replication job name already exists.The specified replication job name already exists.
400SourceServerState.InvalidThe 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.
400ImageName.UsedByReplicationJobThe 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.
400InvalidOsMigrationType.NotMatchedThe 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.
403EntityNotExist.RoleThe 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.
403RealNameAuthenticationErrorYou must perform real-name verification for your account.The account does not have real-name authentication. Please perform real-name authentication first.
500InternalErrorAn 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 timeSummary of changesOperation
2024-09-27The Error code has changed. The request parameters of the API has changedView Change Details
2024-03-28The Error code has changedView Change Details