You can call this operation to split, merge, or modify reserved instances.

Description

When you call this operation, take note of the following items:

  • For information about limits on reserved instances, see the "Limits" section in Reserved instance overview.
  • If you call this operation to split a reserved instance, make sure that you fully understand the limits on splitting a reserved instance. For more information, see Split a reserved instance.
  • If you call this operation to merge reserved instances, make sure that you fully understand the limits on merging reserved instances. For more information, see Merge reserved instances.
  • If you call this operation to modify a reserved instance, make sure that you fully understand the limits and methods of modifying a reserved instance. For more information, see Modify a reserved instance.

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 ModifyReservedInstances

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

RegionId String Yes cn-hangzhou

The region ID of the reserved instance.

You can call the DescribeRegions operation to query the most recent region list.

ReservedInstanceId.N RepeatList Yes ReservedInstanceId.1="ecsri-bp1cx3****",ReservedInstanceId.2="ecsri-bp15xx2****"......

The ID of reserved instance N. Valid values of N: 1 to 20.

Configuration.N.ZoneId String No cn-hangzhou-i

The zone ID of reserved instance N. Valid values of N: 1 to 100.

This parameter is required when Scope is set to Zone.

You can call the DescribeZones operation to query the most recent zone list.

Configuration.N.ReservedInstanceName String No testReservedInstanceName

The name of reserved instance N. Valid values of N: 1 to 100.

The name must be 2 to 128 characters in length. It must start with a letter but cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

Configuration.N.InstanceType String No ecs.c5.4xlarge

The number of instance types that reserved instance N can match. Valid values of N: 1 to 100.

Note The applicable instance types are continuously updated. For more information, see the "Attributes" section in Reserved instance overview.
Configuration.N.Scope String No Zone

The scope of reserved instance N. Valid values:

  • Region: regional
  • Zone: zonal

Valid values of N: 1 to 100.

Default value: Region.

Configuration.N.InstanceAmount Integer No 1

The number of pay-as-you-go instances that are of the instance type matched with reserved instance N. The value must be greater than or equal to 1. Valid values of N: 1 to 100.

Response parameters

Parameter Type Example Description
RequestId String ED9E4A5F-FF4D-4C96-BE80-6B4227060DD7

The ID of the request.

ReservedInstanceIdSets List {"ReservedInstanceId":"ecsri-bp1cx3****","ecsri-bp15xx2****"]}

The list of reserved instance IDs.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=ModifyReservedInstances
&RegionId=cn-hangzhou
&ReservedInstanceId.1=ecsri-bp1cx3****
&ReservedInstanceId.2=ecsri-bp15xx2****
&Configuration.1.InstanceType=ecs.c5.4xlarge
&Configuration.1.Scope=Zone
&Configuration.2.InstanceType=ecs.g5.4xlarge
&Configuration.2.Scope=Region
&<Common request parameters>

Sample success responses

XML format

<ModifyReservedInstancesResponse>
      <ReservedInstanceIdSets>
            <ReservedInstanceId>ecsri-bp1cx3****</ReservedInstanceId>
            <ReservedInstanceId>ecsri-bp15xx2****</ReservedInstanceId>
      </ReservedInstanceIdSets>
      <RequestId>ED9E4A5F-FF4D-4C96-BE80-6B4227060DD7</RequestId>
</ModifyReservedInstancesResponse>

JSON format

{
    "ReservedInstanceIdSets": {
        "ReservedInstanceId": [
            "ecsri-bp1cx3****",
            "ecsri-bp15xx2****"
        ]
    },
    "RequestId": "ED9E4A5F-FF4D-4C96-BE80-6B4227060DD7"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidInstanceType.ValueUnauthorized The specified InstanceType is not authorized. The error message returned because you are not authorized to use the specified instance type.
403 OperationDenied.NoStock The requested resource is sold out in the specified zone; try other types of resources or other regions and zones. The error message returned because the requested resources are insufficient.
500 InternalError The request processing has failed due to some unknown error. The error message returned because an internal error has occurred. Try again later. If the problem persists, submit a ticket.
403 OperationDenied Sales of this resource are temporarily suspended in the specified region; please try again later. The error message returned because the sales of the requested resource are suspended in the specified region. Try again later.
400 InvalidParameter.Conflict The specified region and cluster do not match. The error message returned because the specified region does not match the specified cluster.
403 NodeControllerUnavailable The Node Controller is temporarily unavailable. The error message returned because the node controller is unavailable.
403 OperationDenied The resource is out of usage. The error message returned because the instance is not in the Running state. Start the instance or check whether the specified operation is valid.
403 InvalidParameter.ResourceOwnerAccount ResourceOwnerAccount is Invalid. The error message returned because the specified ResourceOwnerAccount parameter is invalid.
403 Zone.NotOpen The specified zone is not granted to you to buy resources yet. The error message returned because you are not authorized to purchase resources in the specified zone.
403 Zone.NotOnSale The specified zone is not available for purchase. The error message returned because the requested instance resources are unavailable in the specified zone. Change the instance type or select a different zone.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. The error message returned because the specified Tag.N.Key parameter is invalid.
400 RegionUnauthorized %s The error message returned because you are not authorized to perform the operation in the specified region.
500 InternalError %s The error message returned because an internal error has occurred.
400 Zone.NotOnSale %s The error message returned because the sales of the specified resources in the specified zone are suspended.
400 InvalidPeriodUnit.ValueNotSupported The specified parameter PeriodUnit is not valid. The error message returned because the specified PeriodUnit parameter is invalid.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. The error message returned because the specified Tag.N.Value parameter is invalid.
403 InvalidParameter.NotMatch %s The error message returned because the specified parameter is invalid. Check whether the parameter conflicts with another parameter.
403 Account.Arrearage Your account has been in arrears. The error message returned because your account balance is insufficient. Add funds to your account before you proceed.
400 InvalidChargeType.ValueNotSupported ChargeType is not valid The error message returned because the billing method is invalid.
403 IncorrectInstanceStatus The current status of the resource does not support this operation. The error message returned because the operation is not supported while the resource is in the current state.

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