:original_name: ResizeInstance_0.html
.. _ResizeInstance_0:
Modifying Instance Specifications
=================================
Function
--------
This API is used to modify specifications of a DCS instance in the **Running** state.
Constraints
-----------
Currently, the specifications of a Proxy Cluster DCS Redis 3.0 instance cannot be reduced.
URI
---
POST /v2/{project_id}/instances/{instance_id}/resize
.. table:: **Table 1** Path Parameters
=========== ========= ====== ============
Parameter Mandatory Type Description
=========== ========= ====== ============
instance_id Yes String Instance ID.
project_id Yes String Project ID.
=========== ========= ====== ============
Request Parameters
------------------
.. table:: **Table 2** Request body parameters
+---------------------+-----------------+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Parameter | Mandatory | Type | Description |
+=====================+=================+=========================================================================+===========================================================================================================================================================================================================================================================================================================================================================================================================+
| spec_code | Yes | String | Flavor after the modification. The query method is as follows: |
| | | | |
| | | | - Method 1: Read the *Service Overview* document. |
| | | | |
| | | | - Method 2: Log in to the DCS console, click **Create DCS Instance**, and check the instance flavor. |
| | | | |
| | | | - Method 3: Call the API used to query product flavors. |
+---------------------+-----------------+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| new_capacity | Yes | Integer | New memory size of the DCS instance, in GB. For a single-node or master/standby DCS Redis 4.0, 5.0, or 6.0 instance, the value can be **0.125**, **0.25**, **0.5**, **1**, **2**, **4**, **8**, **16**, **32**, or **64**. For a Redis Cluster DCS Redis 4.0 or 5.0 instance, the value can be **24**, **32**, **48**, **64**, **96**, **128**, **192**, **256**, **384**, **512**, **768**, or **1024**. |
+---------------------+-----------------+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| bss_param | No | :ref:`BssParamEntity ` object | This parameter does not need to be set for pay-per-use instances. |
+---------------------+-----------------+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| reserved_ip | No | Array of strings | IP addresses to retain. Mandatory during cluster scale-in. If this parameter is not set, the system randomly deletes unnecessary shards. |
+---------------------+-----------------+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| change_type | No | String | Modification type. Mandatory when the number of replicas of a DCS Redis 4.0 or 5.0 instance is modified. |
| | | | |
| | | | - **createReplication**: adding replicas |
| | | | |
| | | | - **deleteReplication**: deleting replicas |
| | | | |
| | | | - **instanceType**: changing the instance type. |
| | | | |
| | | | Enumeration values: |
| | | | |
| | | | - **createReplication** |
| | | | |
| | | | - **deleteReplication** |
| | | | |
| | | | - **instanceType** |
+---------------------+-----------------+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| available_zones | No | Array of strings | Code of the AZ where each replica is in. This parameter is mandatory when you add replicas to a DCS Redis 4.0 or 5.0 instance. Before specifying an AZ, ensure that there are available resources in it. This parameter is mandatory when you delete replicas from a cluster instance. |
| | | | |
| | | | For details, see the API for querying AZs. |
+---------------------+-----------------+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| node_list | No | Array of strings | ID of the replica to delete. This parameter is mandatory when you delete replicas of a master/standby DCS Redis 4.0 or 5.0 instance. Currently, only one replica can be deleted at a time. |
| | | | |
| | | | For details, see the API for querying details of shards and replicas. |
+---------------------+-----------------+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| execute_immediately | No | Boolean | Whether to apply the change immediately. The default value is **true**. |
| | | | |
| | | | - **true**: Apply the change immediately. |
| | | | |
| | | | - **false**: Apply the change during the maintenance window. . |
+---------------------+-----------------+-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. _resizeinstance_0__request_bssparamentity:
.. table:: **Table 3** BssParamEntity
=========== ========= ====== =====================================
Parameter Mandatory Type Description
=========== ========= ====== =====================================
is_auto_pay No String This parameter is currently not used.
=========== ========= ====== =====================================
Response Parameters
-------------------
None
Example Requests
----------------
.. code-block:: text
POST https://{dcs_endpoint}/v2/{project_id}/instances/{instance_id}/resize
{
"spec_code" : "redis.ha.xu1.tiny.r2.512",
"new_capacity" : 1,
"reserved_ip" : [ "192.168.0.125" ],
"change_type" : "createReplication",
"available_zones" : [ "e7afd64502d64fe3bfb60c2c82ec0ec6", "d90ff6d692954373bf53be49cf3900cb" ],
"node_list" : [ "ff80808282eee5f90183120188ae093e" ],
"execute_immediately" : true
}
Example Responses
-----------------
None
Status Codes
------------
=========== ==================================================
Status Code Description
=========== ==================================================
204 DCS instance specifications modified successfully.
=========== ==================================================
Error Codes
-----------
See :ref:`Error Codes `.