PurchaseStorageCapacityUnit

更新时间:
复制 MD 格式

Purchases one or more storage capacity units (SCUs).

Operation description

**Before you call this operation, make sure that you understand the billing methods and pricing of SCUs.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:PurchaseStorageCapacityUnit

create

*StorageCapacityUnit

acs:ecs:{#regionId}:{#accountId}:scu/*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

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

Name

string

No

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

Capacity

integer

Yes

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

20

Description

string

No

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

ScuPurchaseDemo

StartTime

string

No

The time at which the SCU takes effect. The time can be up to 180 days 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-09T02Z

Period

integer

No

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

PeriodUnit

string

No

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

  • Month

  • Year

Default value: Month.

Month

FromApp

string

No

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

OpenAPI

ClientToken

string

No

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

Amount

integer

No

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

Default value: 1.

1

Tag

array<object>

No

The tags to add to the SCU. You can specify up to 20 tags.

object

No

Tag N to add to the SCU.

Key

string

No

The key of tag N to add to the SCU. The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.

TestKey

Value

string

No

The value of tag N to add to the SCU. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot contain http:// or https://. The tag value cannot start with acs:.

TestValue

ResourceGroupId

string

No

The ID of the resource group to which to add the SCU. You can specify only the IDs of the resource groups that you have permissions to access.

rg-bp67acfmxazb4p****

Response elements

Element

Type

Description

Example

object

OrderId

string

The order ID.

204135153880****

RequestId

string

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

StorageCapacityUnitIds

object

StorageCapacityUnitId

array

The IDs of the SCUs.

string

The ID of the SCU.

scu-bp67acfmxazb4p****

Examples

Success response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter.Period The specified Period is not valid. The specified effective date is invalid.
400 MissingParameter.RegionId The specified RegionId should not be null. The RegionId parameter is required.
400 InvalidParameter.Name The specified Name is invalid. The specified Name parameter is invalid.
400 InvalidParameter.Capacity The specified Capacity is invalid. The specified Capacity value is out of range.
400 MissingParameter.Capacity The specified Capacity should be not null. The Capacity parameter is required.
400 InvalidParameter.PeriodUnit The specified PeriodUnit is not supported. The specified PeriodUnit parameter is invalid.
400 InvalidParameter.CapacityExceed The specified Capacity exceeds the limitation of quota. The specified Capacity value exceeds the maximum allowed value.
400 InvalidStartTime.NotSupported The 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.
400 InvalidStartTime.MalFormed The specified StartTime is out of the permitted range. The specified StartTime value exceeds the maximum allowed value.
500 InternalError The request processing has failed due to some unknown error.
404 InvalidResourceGroup.NotFound The ResourceGroup provided does not exist in our records. The specified resource group does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.