You can call the CreateCloudMigrationTask operation to create a cloud migration task for an ApsaraDB RDS for PostgreSQL instance.

Prerequisites

Before you call this operation, make sure that the ApsaraDB RDS for PostgreSQL instance passes the cloud migration assessment.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateCloudMigrationTask

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

DBInstanceName String Yes pgm-bp102g323jd4****

The ID of the ApsaraDB RDS for PostgreSQL instance. You can call the DescribeDBInstances operation to query the ID of the instance.

SourceIpAddress String Yes 172.16.XX.XX

The private or public IP address that is used to connect to the self-managed PostgreSQL instance.

  • If the self-managed PostgreSQL instance resides on an Elastic Compute Service (ECS) instance, enter the private IP address of the ECS instance. For more information, see View IP addresses.
  • If the self-managed PostgreSQL instance resides in an on-premises data center, enter the private IP address of the on-premises data center.
  • In the self-managed PostgreSQL instance resides on a device that is connected over the Internet, enter the public IP address of the device.
SourcePort Long Yes 5432

The port number that is used to connect to the self-managed PostgreSQL instance. You can run the netstat -a grep PGSQL command to obtain the port number.

SourceAccount String Yes migratetest

The username of the account that is used for cloud migration. For more information, see Create an account for cloud migration on a self-managed PostgreSQL instance.

SourcePassword String Yes 123456

The password of the preceding account. For more information, see Create an account for cloud migration on a self-managed PostgreSQL instance.

TaskName String No 362c6c7a-4d20-4eac-898c-1495ceab374c

The name of the task. You can specify a custom task name. If you do not specify this parameter, ApsaraDB RDS automatically generates a task name.

SourceCategory String Yes ecsOnVpc

The environment in which the self-managed PostgreSQL instance runs.

  • idcOnVpc: The self-managed PostgreSQL instance resides in an on-premises data center, which can communicate with the virtual private cloud (VPC) to which the ApsaraDB RDS for PostgreSQL instance belongs.
  • ecsOnVpc: The self-managed PostgreSQL instance resides on an ECS instance.
  • internet: The self-managed PostgreSQL instance resides on a device that is connected over the Internet.

Response parameters

Parameter Type Example Description
DBInstanceName String pgm-bp102g323jd4****

The name of the ApsaraDB RDS for PostgreSQL instance.

RequestId String 8B993DA9-5272-5414-94E3-4CA8BA0146C2

The ID of the request.

TaskId Long 440437220

The ID of the task.

TaskName String 362c6c7a-4d20-4eac-898c-1495ceab374c

The name of the task.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=CreateCloudMigrationTask
&DBInstanceName=pgm-bp102g323jd4****
&SourceIpAddress=172.16.XX.XX
&SourcePort=5432
&SourceAccount=migratetest
&SourcePassword=123456
&TaskName=362c6c7a-4d20-4eac-898c-1495ceab374c
&SourceCategory=ecsOnVpc
&<Common request parameters>

Sample success responses

XML format

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

<CreateCloudMigrationTaskResponse>
    <DBInstanceName>pgm-bp102g323jd4****</DBInstanceName>
    <RequestId>8B993DA9-5272-5414-94E3-4CA8BA0146C2</RequestId>
    <TaskId>440437220</TaskId>
    <TaskName>362c6c7a-4d20-4eac-898c-1495ceab374c</TaskName>
</CreateCloudMigrationTaskResponse>

JSON format

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

{
  "DBInstanceName" : "pgm-bp102g323jd4****",
  "RequestId" : "8B993DA9-5272-5414-94E3-4CA8BA0146C2",
  "TaskId" : 440437220,
  "TaskName" : "362c6c7a-4d20-4eac-898c-1495ceab374c"
}

Error codes

HTTP status code Error code Error message Description
400 IncorrectDBInstanceState The current instance state does not support this operation. The error message returned because the operation is not supported when the instance is in the current state.
403 IncorrectDBInstance The current DB instance does not support this operation. The error message returned because the operation is not supported by the instance.
403 IncorrectDBInstanceType The database instance type does not support the operation. The error message returned because the operation is not supported for the database engine that is run by the instance.
404 InvalidDBInstanceName.NotFound The database instance does not exist. The error message returned because the instance name that you specified cannot be found. Verify that the instance name and try again.
404 IncorrectDBInstanceLockMode Current DB instance lock mode does not support this operation. The error message returned because the instance is locked.

For a list of error codes, visit the API Error Center.