You can call the ModifyDBInstanceSpec operation to change the instance type or storage capacity of an ApsaraDB RDS instance. This operation is supported for primary instances and read-only instances. This operation is not supported for disaster recovery instances or temporary instances.

Before you call this operation, make sure that the following requirements are met:

  • The instance must be in the Running state.
  • The instance must not have ongoing backup tasks.
  • At least one of the DBInstanceClass and DBInstanceStorage parameters must be specified in the request.
  • If you want to decrease the storage capacity, the new storage capacity that you specify must be greater than or equal to 1.1 times the used storage capacity.
  • The instance is a primary instance or read-only instance.
Note If you want to upgrade the RDS edition of the instance, you need only to select an instance type that supports the new RDS edition. For example, if you want to upgrade the RDS edition of the instance from the Basic Edition to the High-availability Edition, you need only to select an instance type that supports the High-availability Edition.

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 ModifyDBInstanceSpec

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

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

DBInstanceClass String No rds.mys2.small

The new instance type of the instance. For more information, see Primary ApsaraDB RDS instance types. You can call the DescribeAvailableClasses operation to query the instance types that are available to a region.

Note
  • You must specify at least one of the DBInstanceClass and DBInstanceStorage parameters.
  • You can call the DescribeDBInstanceAttribute operation to query the current instance type of the instance.
DBInstanceStorage Integer No 20

The new storage capacity of the instance. Unit: GB. You can increase the storage capacity in increments of 5 GB. For more information, see Primary ApsaraDB RDS instance types. You can call the DescribeAvailableClasses operation to query the storage capacity range that is supported for an instance type.

Note
  • You must specify at least one of the DBInstanceStorage and DBInstanceClass parameters.
  • If the instance runs MySQL on RDS High-availability Edition with local SSDs, you can decrease the storage capacity at a step size of 5 GB.
  • You can call the DescribeDBInstanceAttribute operation to query the current storage capacity of the instance.
PayType String Yes Postpaid

The billing method of the instance. Valid values:

  • Postpaid: pay-as-you-go
  • Prepaid: subscription
EffectiveTime String No MaintainTime

The time when you want to apply the specification changes. Valid values:

  • Immediate: The specification changes are immediately applied.
  • MaintainTime: The specification changes are applied during the specified maintenance window. For more information, see ModifyDBInstanceMaintainTime.

Default value: Immediate.

EngineVersion String No 5.6

The database engine version that is run on the instance. Valid values:

  • MySQL: 5.5, 5.6, 5.7, and 8.0
  • SQLServer: 2008r2/08r2_ent_ha/2012/2012_ent_ha/2012_std_ha/2012_web/2016_ent_ha/2016_std_ha/2016_web/2017_std_ha/2017_ent/2019_std_ha/2019_ent
  • PostgreSQL: 10.0, 11.0, 12.0, 13.0 and 14.0
  • MariaDB TX: 10.3
DBInstanceStorageType String No local_ssd

The type of storage media that is used for the instance. Valid values:

  • local_ssd: local SSDs.
  • cloud_ssd: SSD cloud disks. This storage medium is not recommended and is unavailable in some Alibaba Cloud regions.
  • cloud_essd: enhanced SSDs (ESSDs).
Direction String No Up

The type of change that you want to perform on the instance. Valid values:

  • Up: upgrades a subscription instance, or upgrades or downgrades a pay-as-you-go instance.
  • Down: downgrades a subscription instance.

Default value: Up.

Note If you specify only the DBInstanceStorageType parameter, you can leave the Direction parameter empty. For example, if you want only to change the storage media of the instance from standard SSD to ESSD, you do not need to specify the Direction parameter.
SourceBiz String No N/A

A deprecated parameter.

DedicatedHostGroupId String No dhg-7a9********

The ID of the dedicated cluster to which the instance belongs.

ZoneId String No cn-hangzhou-b

The zone ID of the instance.

SwitchTime String No 2019-07-10T13:15:12Z

The time at which you want to apply the specification changes. We recommend that you apply the specification during off-peak hours. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

ResourceGroupId String No rg-acfmy**********

The ID of the resource group to which the instance belongs.

UsedTime Long No 3

The validity period of the specification changes on an ApsaraDB RDS for SQL Server instance. At the end of the validity period, the specification of the instance is restored to the specification that is used before an elastic upgrade is performed. Unit: days.

Response parameters

Parameter Type Example Description
DBInstanceId String rm-uf6wjk5xxxxxxx

The ID of the instance.

RequestId String 3C5CFDEE-F774-4DED-89A2-1D76EC63C575

The ID of the request.

OrderId Long 207938506080728

The ID of the order.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=ModifyDBInstanceSpec
&DBInstanceId=rm-uf6wjk5xxxxxxx
&PayType=Postpaid
&DBInstanceClass=rds.mys2.small
&<Common request parameters>

Sample success responses

XML format

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

<ModifyDBInstanceSpecResponse>
<RequestId>3C5CFDEE-F774-4DED-89A2-1D76EC63C575</RequestId>
<DBInstanceId>rm-uf6wjk5xxxxxxx</DBInstanceId>
<OrderId>207938506080728</OrderId>
</ModifyDBInstanceSpecResponse>

JSON format

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

{
  "RequestId" : "3C5CFDEE-F774-4DED-89A2-1D76EC63C575",
  "DBInstanceId" : "rm-uf6wjk5xxxxxxx",
  "OrderId" : 207938506080728
}

Error codes

HTTP status code Error code Error message Description
400 CannotDecreaseEssdPerfLevel cannot decrease cloud essd performance level. The error message returned because the change of storage media is not allowed. The storage media of an instance that runs SQL Server with standard SSDs can be changed only to ESSDs. The storage media of an instance that runs SQL Server with local SSDs can be changed to standard SSDs or ESSDs.
400 InvalidEssdStorageSize invalid cloud essd storage size. The error message returned because the specified instance type is invalid. Select a valid instance type and try again.
400 NotSupportReduceDiskSize Not support reduce disk size. The error message returned because the storage capacity of the instance cannot be changed.
400 INST_HAS_UNPAID_ORDER The specified Instance has unpaid order. The error message returned because the instance has unpaid orders. You must pay for the orders before you call this operation.
400 InvalidDBInstanceClass.NotFound Specified DB instance class is not found. The error message returned because the new instance type cannot be found or is no longer available for sale. Select an available new instance type.
400 InvalidAvZone.Format Specified AvZone is not valid. The error message returned because the value of the ZoneID parameter is invalid.
400 OperationDenied.OrderUnPaid The operation is not permitted due to the wrong Order status (Unpaid). The error message returned because you have unpaid orders. You must pay for the orders before you call this operation.
400 OperationDenied.InvalidStorageSize The storage size limit is exceeded. The error message returned because the new storage capacity exceeds the maximum disk space. You must clear or expand the disk space.
400 InsufficientResourceCapacity The instance cluster does not support this operation. The error message returned because the operation is not supported in the dedicated cluster to which the instance belongs.
400 InvalidUsedTime The parameter usedTime is invalid. The error message returned because the value of the UsedTime parameter is invalid.
400 CannotChangeStorageType Temp upgrade does not support changing storage type. The error message returned because elastic upgrades do not support storage type changes.
400 TempUpgrade.NotSupport The instance does not support temp upgrade. The error message returned because the instance does not support elastic upgrades.
400 EngineNotSupported Engine specified cannot be supported the operation. The error message returned because this operation is not supported for the database engine that is run on the instance.
403 IncorrectDBInstanceType The database instance type does not support the operation. The error message returned because this operation is not supported for the instance type that is used on the instance.
403 OperationDenied.NotSupportedBackupMethod When the storage is larger than 4000 GB, only snapshot backup is supported. The error message returned because the storage capacity is greater than 4,000 GB and only snapshot backups are supported.
403 IncorrectReadDBInstanceDisksize Read instance disk size must be equal or higher than primary instance. The error message returned because the storage capacity of the read-only instance is less than the storage capacity of the primary instance. Make sure that the storage capacity of the read-only instance is equal to or greater than the storage capacity of the primary instance.

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