Enables or disables the automatic primary/secondary switchover function of an ApsaraDB for RDS instance.

After a primary/secondary switchover, the primary instance is demoted to secondary while the secondary instance is promoted to primary. For more information, see Manually or automatically switch over services between the RDS MySQL master and slave instances.

Before you call this operation, make sure that the instance runs MySQL in the High-availability Edition.


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 ModifyHASwitchConfig

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

DBInstanceId String Yes rm-uf6wjk5xxxxxxxxxx

The ID of the instance.

RegionId String Yes cn-hangzhou

The ID of the region to which the instance belongs. You can call the DescribeRegions operation to query the most recent region list.

HAConfig String No Manual

The primary/secondary switchover mode of the instance. Valid values:

  • Auto: The system automatically switches over services from the primary to secondary instances in the event of a fault.
  • Manual: You must manually switch over services from the primary to secondary instances in the event of a fault.

Default value: Auto.

Note If you set this parameter to Manual, you must specify the ManualHATime parameter.
ManualHATime String No 2019-08-29T15:00:00Z

The time after when you want to enable automatic primary/secondary switchover. At most, you can set this parameter to 23:59:59 seven days later. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Note This parameter only takes effect when the HAConfig parameter is set to Manual.

Response parameters

Parameter Type Example Description
RequestId String B6AE1448-D846-4831-B1C7-CFF3E99D5470

The ID of the request.


Sample requests

http(s)://rds.aliyuncs.com/? Action=ModifyHASwitchConfig
&<Common request parameters>

Sample success responses

XML format


JSON format

    "RequestId": "B6AE1448-D846-4831-B1C7-CFF3E99D5470"

Error codes

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