Create reserved instances
Updated at:2025-10-20
This API is used to create reserved instances.
Request structure
Plain Text
1POST /v{version}/instance/reserved/create HTTP/1.1
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4{
5 "reservedInstanceName": reservedInstanceName,
6 "scope": scope,
7 "zoneName": zoneName,
8 "spec":spec,
9 "offeringType":offeringType,
10 "instanceCount":instanceCount,
11 "reservedInstanceCount":reservedInstanceCount,
12 "reservedInstanceTime":reservedInstanceTime,
13 "reservedInstanceTimeUnit":reservedInstanceTimeUnit,
14 "autoRenewTimeUnit":autoRenewTimeUnit,
15 "autoRenewTime":autoRenewTime,
16 "autoRenew":autoRenew,
17 "effectiveTime":effectiveTime,
18 "tags": [
19 "tagKey":tagKey,
20 "tagValue":tagValue
21 ],
22 "ticketId":ticketId,
23 "ehcClusterId":ehcClusterId
24}
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number |
| clientToken | String | No | Query | Idempotence Token, which is an ASCII string with a length not exceeding 64 bits. For details, see the [Link](#ClientToken Idempotency Support) |
| reservedInstanceName | String | No | requestBody parameters | Rules: Support uppercase and lowercase letters, numbers, Chinese characters and special characters -_ /. It must start with a Chinese character or letter, have a length of 1 - 65 characters and can be repeated. If not named by the customer, it will be automatically named as reservedInstance-${randomly generated}, following the same naming rules |
| scope | String | No | requestBody parameters | Availability scope of the instance coupon; default: AZ |
| zoneName | String | Yes | requestBody parameters | Availability zone, e.g., cn-bj-a |
| spec | String | Yes | requestBody parameters | Instance specification, for example: bcc.g4.c2m8 |
| offeringType | String | Yes | requestBody parameters | Default: Fully prepay (FullyPrepay) |
| instanceCount | String | No | requestBody parameters | Instance count, defaulting to 1. It cannot be changed |
| reservedInstanceCount | String | No | requestBody parameters | Specify the number of reserved instances, with a default value of 1. The count cannot exceed the quota (default quota: 20). If you require a higher quota, please submit a ticket request. |
| reservedInstanceTime | String | Yes | requestBody parameters | Purchase period of the reserved instance, supporting 3, 6, 9, 12, 24 and 36 months |
| reservedInstanceTimeUnit | String | No | requestBody parameters | Purchase period unit of the reserved instance, defaulting to month. It cannot be changed |
| autoRenew | Boolean | No | requestBody parameters | Automatic renewal switch. Default: false |
| autoRenewTimeUnit | String | No | requestBody parameters | Auto-renewal period unit of the reserved instance, defaulting to month. It cannot be changed |
| autoRenewTime | String | No | requestBody parameters | Automatic renewal period of the reserved instance, supporting 3, 6, 9, 12, 24 and 36 months. It is required and must be consistent with reservedInstanceTime when autoRenew is true |
| effectiveTime | String | No | requestBody parameters | The effective time defaults to immediate activation. For custom settings, the effective time cannot exceed 1 day and must align with 15-minute intervals (e.g., 10:00, 10:15, 10:30, 10:45, 11:00). |
| tags | List<TagModel> | No | RequestBody | List of tags to be created. For the specific data format, refer to the following TagModel |
| ticketId | String | No | requestBody parameters | Coupon ID |
| ehcClusterId | String | No | requestBody parameters | Optional for creating a RoCE reserved instance; if empty, the default EHC cluster will be used. |
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| orderId | String | Order ID for creating the reserved instance |
| reservedInstanceIds | Array | Collection of reserved instance IDs |
Error codes
| Error code | Error description | HTTP status code | Chinese explanation |
|---|---|---|---|
| BadRequest | request is invalid | 400 | Invalid request parameters |
Request example
Plain Text
1POST http://bcc.bj.baidubce.com/v2/instance/reserved/create
2Host: bcc.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4
5{
6 "reservedInstanceName": "test",
7 "scope": "AZ",
8 "zoneName": "cn-bj-a",
9 "spec": "bcc.g4.c2m8",
10 "offeringType": "FullyPrepay",
11 "instanceCount": 1,
12 "reservedInstanceCount": 1,
13 "reservedInstanceTime": 12,
14 "reservedInstanceTimeUnit": "month",
15 "autoRenewTimeUnit": "month",
16 "autoRenewTime": 12,
17 "autoRenew": true,
18 "effectiveTime": "2023-05-22T21:00:00Z",
19 "tags": [
20 {
21 "tagKey": "test",
22 "tagValue": "test"
23 }
24 ],
25 "ticketId": ""
26}
Response example
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3Date: Wed, 08 Jul 2015 03:28:11 GMT
4x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5
5Server: BWS
6
7{
8 "reservedInstanceIds": [
9 "test_f0c549b9614f"
10 ],
11 "orderId": "orderId"
12}
