You can call the ActivateMigrationTargetInstance operation to switch workloads over to an ApsaraDB RDS for PostgreSQL instance.
Prerequisites
Before you call the ActivateMigrationTargetInstance operation, make sure a cloud migration task is created by calling the CreateCloudMigrationTask operation. In addition, make sure that the value that is returned for the MigrateStage parameter from the call of the DescribeCloudMigrationResult operation is increment.
Debugging
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | ActivateMigrationTargetInstance |
The operation that you want to perform. Set the value to ActivateMigrationTargetInstance. |
| 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. |
| SwitchTime | String | No | 2022-02-25T06:57:41Z |
A reserved parameter. This parameter does not take effect. |
| SwitchTimeMode | String | No | 0 |
The time when you want to perform the switchover. Set the value to 0. The value 0 specifies an immediate switchover. |
| ForceSwitch | String | No | 1 |
Specifies whether to forcefully perform a switchover. Set the value to 1. The value 1 specifies a forceful switchover. |
Response parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
| DBInstanceName | String | pgm-bp102g323jd4**** |
The name of the ApsaraDB RDS for PostgreSQL instance. |
| RequestId | String | 76364A52-E0AB-5CC8-9818-CF1DC482C092 |
The ID of the request. |
| TaskId | Long | 440913675 |
The ID of the task. |
| SourceIpAddress | String | 172.16.XX.XX |
The private or public IP address that is used to connect to the self-managed PostgreSQL instance. |
| SourcePort | Long | 5432 |
The port number that is used to connect to the self-managed PostgreSQL instance. |
Examples
Sample requests
http(s)://rds.aliyuncs.com/?Action=ActivateMigrationTargetInstance
&DBInstanceName=pgm-bp102g323jd4****
&SwitchTime=2022-02-25T06:57:41Z
&SwitchTimeMode=0
&ForceSwitch=1
&<Common request parameters>
Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<ActivateMigrationTargetInstanceResponse>
<DBInstanceName>pgm-bp102g323jd4****</DBInstanceName>
<RequestId>76364A52-E0AB-5CC8-9818-CF1DC482C092</RequestId>
<TaskId>440913675</TaskId>
<SourceIpAddress>172.16.XX.XX</SourceIpAddress>
<SourcePort>5432</SourcePort>
</ActivateMigrationTargetInstanceResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"DBInstanceName" : "pgm-bp102g323jd4****",
"RequestId" : "76364A52-E0AB-5CC8-9818-CF1DC482C092",
"TaskId" : 440913675,
"SourceIpAddress" : "172.16.XX.XX",
"SourcePort" : 5432
}
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 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.