You can call this operation to modify reserved instances. You can change the name, zone, and instance types of the same instance family, and merge or split reserved instances.

Description

Before you modify reserved instances, ensure that you have read the following notes:

  • You can only change the zone of a reserved instance, change region-level reserved instances to zone-level ones, or change zone-level reserved instances to region-level ones. The region of a reserved instance cannot be changed.
  • You can only change the instance type of a reserved instance. The instance family of a reserved instance cannot be changed.
  • If the reserved instances to be merged are region-level ones, they must be in the same region. If the reserved instances to be merged are zone-level ones, they must be in the same zone.
  • The reserved instances to be merged must have the same expiration date.
  • After a reserved instance is split, merged, or changed, the original reserved instance will expire immediately.
  • Reserved instances matching t5 and t6 burstable instances are only available at the zone level. These reserved instances cannot be merged or split, and their scopes cannot be changed.

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
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-bp1cxxxxxxxxxxxxxxxx",ReservedInstanceId.2="ecsri-bp15xxxxxxxxxxxxxxxx"......

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

Action String Yes ModifyReservedInstances

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

Configuration.N.InstanceAmount Integer No 1

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

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

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

  • The instance types that the zone-level reserved instance can match include: c6, g6, r6, c5, g5, r5, hfc5, hfg5, ic5, se1ne, sn1ne, sn2ne, i2, t5, and t6.
  • The instance types that the region-level reserved instance can match include: c6, g6, r6, c5, g5, r5, hfc5, hfg5, ic5, se1ne, sn1ne, sn2ne, and i2.
Configuration.N.ReservedInstanceName String No xxxxxxxxxxxxxxxx

The name of the reserved instance. 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.Scope String No Zone

The scope of the reserved instance. Valid values:

  • Region: region-level
  • Zone: zone-level

Valid values of N: 1 to 100.

Default value: Region

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

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

If the Scope parameter is Zone, it cannot be empty.

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

Response parameters

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

The ID of the request.

ReservedInstanceIdSets List {"ReservedInstanceId":"ecsri-bp1cxxxxxxxxxxxxxxxx","ecsri-bp15xxxxxxxxxxxxxxxx"]}

The list of reserved instance IDs.

ReservedInstanceId

The list of reserved instance IDs.

Examples

Sample requests


http(s)://ecs.aliyuncs.com/? Action=ModifyReservedInstances
&RegionId=cn-hangzhou
&ReservedInstanceId.1=ecsri-bp1cxxxxxxxxxxxxxxxx
&Configuration.1.InstanceType=ecs.c5.4xlarge
&Configuration.1.Scope=Zone
&ReservedInstanceId.2=ecsri-bp15xxxxxxxxxxxxxxxx
&Configuration.2.InstanceType=ecs.g5.4xlarge
&Configuration.2.Scope=Region
&<Common request parameters>

Sample success responses

XML format

<ModifyReservedInstancesRequest>
    <ReservedInstanceIdSets>
       <ReservedInstanceId>ecsri-bp1cxxxxxxxxxxxxxxxx</ReservedInstanceId>
       <ReservedInstanceId>ecsri-bp15xxxxxxxxxxxxxxxx</ReservedInstanceId>
    </ReservedInstanceIdSets>
    <RequestId>ED9E4A5F-FF4D-4C96-BE80-6B4227060DD7</RequestId>
</ModifyReservedInstancesResponse>

JSON format

{
	"ReservedInstanceIdSets":{
		"ReservedInstanceId":[
			"ecsri-bp1cxxxxxxxxxxxxxxxx",
			"ecsri-bp15xxxxxxxxxxxxxxxx"
		]
	},
	"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 specified resources in the specified region is suspended.
400 InvalidParameter.Conflict The specified region and cluster do not match. The error message returned because the specified region does not correspond to 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 resource owner account 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.
403 InvalidResourceType.NotSupported This resource type is not supported; please try other resource types. The error message returned because the specified combination of resources is unavailable.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. The error message returned because the specified value of the Tag.N.Key parameter is invalid.
400 RegionUnauthorized %s The error message returned because the specified region is not supported.
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 is suspended.
400 InvalidPeriodUnit.ValueNotSupported The specified parameter PeriodUnit is not valid. The error message returned because the specified value of the PeriodUnit parameter is invalid.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. The error message returned because the specified value of the Tag.N.Value parameter is invalid.
403 InvalidParameter.NotMatch %s The error message returned because the parameter is in conflict with another parameter.
403 Account.Arrearage Your account has been in arrears. The error message returned because your account balance is insufficient. You must top up your account before proceeding.
400 InvalidChargeType.ValueNotSupported ChargeType is not valid. The error message returned because the billing method is invalid.
403 IncorrectInstanceStatus The current state 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.