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

ParameterTypeRequiredExampleDescription
ActionStringYesModifyDBInstanceSpec

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

DBInstanceIdStringYesrm-uf6wjk5*******

The ID of the instance.

DBInstanceClassStringNords.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 in-use instance type of the instance.
DBInstanceStorageIntegerNo20

The new storage capacity of the instance. Unit: GB. You can increase the storage capacity at a step size 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.
PayTypeStringYesPostpaid

The billing method of the instance. Valid values:

  • Postpaid: pay-as-you-go
  • Prepaid: subscription
EffectiveTimeStringNoMaintainTime

The time at which 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.
Note Default value: Immediate.
EngineVersionStringNo5.6

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

  • Valid values for MySQL: 5.5, 5.6, 5.7, and 8.0
  • Valid values for SQL Server: 2008r2, 08r2_ent_ha, 2012, 2012_ent_ha, 2012_std_ha, 2012_web, 2014_std_ha, 2016_ent_ha, 2016_std_ha, 2016_web, 2017_std_ha, 2017_ent, 2019_std_ha, and 2019_ent
  • Valid values for PostgreSQL: 10.0, 11.0, 12.0, 13.0, 14.0, and 15.0
  • Valid values for MariaDB TX: 10.3
DBInstanceStorageTypeStringNolocal_ssd

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

  • local_ssd: local SSDs.
  • cloud_ssd: standard SSDs. This storage type is not recommended and is unavailable in some Alibaba Cloud regions.
  • cloud_essd: enhanced SSDs (ESSDs) of performance level 1 (PL1).
  • cloud_essd2: ESSD of PL2
  • cloud_essd3: ESSD of PL3

To change the storage type, take note of the following information:

If the instance runs PostgreSQL, you can upgrade the storage type of the instance from standard SSDs to ESSDs. However, you cannot downgrade the storage type of the instance from ESSDs to standard SSDs. ESSDs provide the following performance levels (PLs): ESSDs of PL1, ESSDs of PL2, and ESSDs of PL3. You can upgrade or downgrade the storage type between ESSDs of PL1, ESSDs of PL2, and ESSDs of PL3. For more information, see Configuration items.

DirectionStringNoUp

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.
  • TempUpgrade: automatically changes the specifications of a subscription instance. This value is required for automatic specification changes.
Note
  • Default value: Up.
  • If you specify only the DBInstanceStorageType parameter, you can leave the Direction parameter empty. For example, if you want to change only the storage type of the instance from standard SSDs to ESSDs, you do not need to specify the Direction parameter.
SourceBizStringNoN/A

An invalid parameter.

DedicatedHostGroupIdStringNodhg-7a9********

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

ZoneIdStringNocn-hangzhou-b

The zone ID of the instance.

SwitchTimeStringNo2019-07-10T13:15:12Z

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

Note
  • You must specify a point in time later than the current time, which refers to the time to call this operation. Otherwise, the specification change task fails. If the specification change task fails, you must wait for the order to be automatically canceled and then call this operation again.
  • If the specification change involves only the increase of the storage capacity or the change of the ESSD storage type between different PLs, the specification change immediately takes effect and does not affect your workloads. You do not need to configure this parameter.
ResourceGroupIdStringNorg-acfmy**********

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

UsedTimeLongNo3

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

MaxCapacitydoubleNo8

The maximum value of Rds Capacity Unit (RCU).

MinCapacitydoubleNo0.5

The minimum value of RCU.

AutoPauseBooleanNotrue

Specifies whether to support automatic suspension.

SwitchForceBooleanNofalse

Specifies whether to enable the forced scaling feature for the serverless instance. Valid values:

  • true: The forced scaling feature is enabled.
  • false: The forced scaling feature is disabled. This is the default value.
CategoryStringNoHighAvailability

The RDS edition of the instance. Valid values:

  • Basic: RDS Basic Edition.
  • HighAvailability: RDS High-availability Edition.
  • AlwaysOn: RDS Cluster Edition.
  • Finance: Enterprise Edition. This edition is available only on the China site (aliyun.com).
Note If you set the EngineVersion parameter to an SQL Server version, you must also specify this parameter.

Response parameters

ParameterTypeExampleDescription
DBInstanceIdStringrm-uf6wjk5*******

The ID of the instance.

RequestIdString3C5CFDEE-F774-4DED-89A2-1D76EC63C575

The ID of the request.

OrderIdLong20793850608****

The ID of the order.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=ModifyDBInstanceSpec
&DBInstanceId=rm-uf6wjk5*******
&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-uf6wjk5*******</DBInstanceId>
    <OrderId>20793850608****</OrderId>
</ModifyDBInstanceSpecResponse>

JSON format

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

{
  "RequestId" : "3C5CFDEE-F774-4DED-89A2-1D76EC63C575",
  "DBInstanceId" : "rm-uf6wjk5*******",
  "OrderId" : "20793850608****"
}

Error codes

HTTP status codeError codeError messageDescription
400CannotDecreaseEssdPerfLevelcannot decrease cloud essd performance level.The error message returned because the change of the storage type is not allowed. The storage type of an instance that runs SQL Server with standard SSDs can be changed only to ESSDs. The storage type of an instance that runs SQL Server with local SSDs can be changed to standard SSDs or ESSDs.
400InvalidEssdStorageSizeinvalid cloud essd storage size.The error message returned because the specified instance type is invalid. You must select a valid instance type and try again.
400NotSupportReduceDiskSizeNot support reduce disk size.The error message returned because the storage capacity of the instance cannot be decreased.
400InvalidDBInstanceClass.NotFoundSpecified DB instance class is not found.The error message returned because the new instance type cannot be found or is no longer available for purchase. You must select an available instance type.
400InvalidAvZone.FormatSpecified AvZone is not valid.The error message returned because the value of the ZoneID parameter is invalid.
400OperationDenied.OrderUnPaidThe 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.
400OperationDenied.InvalidStorageSizeThe storage size limit is exceeded.The error message returned because the new storage capacity exceeds the upper limit. You must clear or expand the disk space.
400InsufficientResourceCapacityThe 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.
400InvalidUsedTimeThe parameter usedTime is invalid.The error message returned because the value of the UsedTime parameter is invalid.
400CannotChangeStorageTypeTemp upgrade does not support changing storage type.The error message returned because elastic upgrades do not support storage type changes.
400TempUpgrade.NotSupportThe instance does not support temp upgrade.The error message returned because the instance does not support elastic upgrades.
400EngineNotSupportedEngine 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. You must update the minor engine version.
400MaxscaleNotSupportMaxscale not supportedThe error message returned because the instance does not support the dedicated proxy feature. You must check the dedicated proxy configuration that you specified.
400ADInstanceNotSupportThisOperationThe AD instance is not supported this operationThe error message returned because the operation is not supported for an instance that is added to an Active Directory (AD) domain.
400BYOKInstanceNotSupportThisOperationThe BYOK instance is not supported this operationThe error message returned because the operation is not supported for an instance for which disk encryption is enabled.
400BYOLInstanceNotSupportThisOperationThe BYOL instance is not supported this operationThe error message returned because the operation is not supported for an instance that uses Bring Your Own License (BYOL).
400SSLInstanceNotSupportThisOperationThe instance opened SSL, upgrade is not this operationThe error message returned because the operation is not supported for an instance for which the SSL encryption feature is enabled.
400TDEInstanceNotSupportThisOperationThe instance opened TDE, this operation is not supportedThe error message returned because the operation is not supported for an instance for which the Transparent Data Encryption (TDE) feature is enabled.
400InstanceIsSnapshotBackupNotSupportThisOperationThe instance backup method is snapshot backup, this operation is not supportedThe error message returned because the operation is not supported for an instance for which the snapshot backup feature is enabled.
400InstanceHasReadOnlyInstanceNotSupportThisOperationThe instance has read-only instance or is read-only instance, this operation is not supportedThe error message returned because the operation is not supported for a read-only instance or an instance to which read-only instances are attached.
400IncorrectDBInstanceStateCurrent DB instance state does not support this operation.The error message returned because this operation is not supported when the instance is in the current state.
400BackupReadInstanceModifyNotAllowedModify Backup Read Instance Is Not Allowed.The error message returned because you are not allowed to modify the instance from which the backup comes.
400MinorVersionNotSupportThe current database minor version does not support the operation.The error message returned because the operation is not supported by the current minor engine version.
400LX.ARGUMENT.ILLEGALThe instance configuration does not take effect after you change the instance configuration.The error message returned because the current instance configuration does not take effect after you change the instance configuration.
400ORD.S.QUERY.PROD.ERRORAn error occurred while querying the ordering informationThe error message returned because the order cannot be found.
403IncorrectDBInstanceTypeThe database instance type does not support the operation.The error message returned because the operation is not supported by the database engine that is run on the instance.
403OperationDenied.NotSupportedBackupMethodWhen 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.
403IncorrectReadDBInstanceDisksizeRead 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 greater than or equal to the storage capacity of the primary instance.
404InvalidClusterKmsThe current instance does not authorized to access the Key Management Service.The error message returned because the instance does not have permissions to access Key Management Service (KMS).

For a list of error codes, see Service error codes.