All Products
Search
Document Center

Elastic Compute Service:PurchaseStorageCapacityUnit

Last Updated:Nov 14, 2024

Purchases one or more storage capacity units (SCUs).

Operation description

Usage notes

Before you call this operation, make sure that you are familiar with the billing and pricing of SCUs. For more information, see Storage capacity units.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:PurchaseStorageCapacityUnitcreate
*StorageCapacityUnit
acs:ecs:{#regionId}:{#accountId}:scu/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The ID of the region in which to purchase the SCU. The purchased SCU can offset the bills of pay-as-you-go disks that reside in the specified region. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
NamestringNo

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

ScuPurchaseDemo
CapacityintegerYes

The capacity of the SCU. Unit: GiB. Valid values: 20, 40, 100, 200, 500, 1024, 2048, 5210, 10240, 20480, and 52100.

20
DescriptionstringNo

The description of the SCU. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

ScuPurchaseDemo
StartTimestringNo

The time at which the SCU takes effect. The time can be up to six months from the creation time of the SCU. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHHZ format. The time must be in UTC.

This parameter is left empty by default, which indicates that the SCU takes effect immediately after it is created.

2020-09-09T02:00:00Z
PeriodintegerNo

The validity period of the SCU. Valid values:

  • Valid values when PeriodUnit is set to Month: 1, 2, 3, and 6.
  • Valid values when PeriodUnit is set to Year: 1, 3, and 5.

Default value: 1.

1
PeriodUnitstringNo

The unit of the validity period of the SCU. Valid values:

  • Month
  • Year

Default value: Month.

Month
FromAppstringNo

The source of the request. The value is automatically set to OpenAPI and does not need to be changed. Default value: OpenAPI.

OpenAPI
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but make sure that the token is unique across requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

123e4567-e89b-12d3-a456-426655440000
AmountintegerNo

The number of SCUs that you want to purchase. Valid values: 1 to 20.

Default value: 1.

1
Tagarray<object>No

The list of tags.

objectNo

Tag N to add to the SCU.

KeystringNo

The key of tag N to add to the SCU. N is the identifier of the tag key that you specify. Valid values of N: 1 to 20. The tag key cannot be an empty string. It can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

TestKey
ValuestringNo

The value of tag N. N is the identifier of the tag value that you specify and corresponds to the N in Tag.N.Key. Valid values: 1 to 20. The tag value can be an empty string. It can be up to 128 characters in length. It cannot start with acs: or contain http:// or https://.

TestValue

Response parameters

ParameterTypeDescriptionExample
object
OrderIdstring

The order ID.

204135153880****
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
StorageCapacityUnitIdsarray

The IDs of the SCUs.

StorageCapacityUnitIdstring

The ID of the SCU.

scu-bp67acfmxazb4p****

Examples

Sample success responses

JSONformat

{
  "OrderId": "204135153880****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "StorageCapacityUnitIds": {
    "StorageCapacityUnitId": [
      "scu-bp67acfmxazb4p****"
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter.PeriodThe specified Period is not valid.The specified effective date is invalid.
400MissingParameter.RegionIdThe specified RegionId should not be null.The RegionId parameter is required.
400InvalidParameter.NameThe specified Name is invalid.The specified Name parameter is invalid.
400InvalidParameter.CapacityThe specified Capacity is invalid.The specified Capacity value is out of range.
400MissingParameter.CapacityThe specified Capacity should be not null.The Capacity parameter is required.
400InvalidParameter.PeriodUnitThe specified PeriodUnit is not supported.The specified PeriodUnit parameter is invalid.
400InvalidParameter.CapacityExceedThe specified Capacity exceeds the limitation of quota.The specified Capacity value exceeds the maximum allowed value.
400InvalidStartTime.NotSupportedThe specified StartTime should be within 180 calendar days from the current date, and you must specify a precision to hour.The specified StartTime value is out of range.
400InvalidStartTime.MalFormedThe specified StartTime is out of the permitted range.The specified StartTime value exceeds the maximum allowed value.
500InternalErrorThe request processing has failed due to some unknown error.An internal error has occurred. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-07-28API Description Update. The Error code has changedView Change Details