Updated on 2026-11-06 GMT+08:00

Creating a Compute Resource

Function

This API is used to create a compute resource. This API is asynchronous. You can obtain the operation result by calling the Listing Compute Resource Operation Records API.

Calling Method

For details, see Calling APIs.

URI

POST /v2/workspaces/{workspace_id}/computes

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

workspace_id

Yes

String

Definition: Workspace ID, which can be obtained by calling the Obtaining a Workspace ID API.

Constraints: N/A

Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: User token. It is obtained by calling the Obtaining an IAM User Token API.

Constraints: N/A

Range: Up to 65,534 characters. Only letters, digits, and special characters are allowed. The token format is defined by IAM. For details about the character set, see the IAM documentation.

Default Value: N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition: Compute resource name.

Constraints: N/A

Range: 1 to 63 characters. Only lowercase letters, digits, and hyphens (-) are allowed. It must start with a letter and end with a letter or digit.

Default Value: N/A

description

No

String

Definition: Resource description.

Constraints: N/A

Range: 0 to 512 characters. The following characters are not allowed: exclamation mark (!), less-than sign (<), greater-than sign (>), equal sign (=), ampersand (&), double quotation marks ("), and single quotation mark (').

Default Value: N/A

charge_mode

No

String

Definition: Billing mode.

Constraints: N/A

Range

  • postPaid: Pay-per-use.

  • prePaid: Yearly/monthly.

Default Value: postPaid.

capacity

Yes

Array of CapacityItem objects

Definition: Compute resource capacity configuration, consisting of an array of CapacityItem objects. Each object defines the resource type, resource quantity, resource specification, and other information.

Constraints: 1 to 10 items.

tags

No

Array of V2ResourceTag objects

Definition: Tag list, which consists of an array of V2ResourceTag objects. Each object defines a tag key and tag value.

Constraints: Up to 20 tags.

prometheus_config

No

PrometheusConfig object

Definition: Prometheus monitoring configuration.

Constraints: N/A

Range: N/A

Default Value: N/A

Table 4 CapacityItem

Parameter

Mandatory

Type

Description

type

Yes

String

Definition: Resource type.

Constraints: N/A

Range

  • CPU: Central processing unit.

  • GPU: Graphics processing unit.

  • NPU: Neural processing unit.

Default Value: N/A

capacity

Yes

Integer

Definition: Number of resources. The unit for CPU resources is cores, and the unit for GPU/NPU resources is instances.

Constraints: N/A

Range: 0 to 48,000

Default Value: N/A

spec_code

Yes

String

Definition: Resource specification.

Constraints: N/A

Range: 1 to 64 characters. Only letters, digits, periods (.), and hyphens (-) are allowed.

Default Value: N/A

Table 5 V2ResourceTag

Parameter

Mandatory

Type

Description

key

Yes

String

Definition: Resource tag key.

Constraints: N/A

Range: 1 to 128 characters. Only letters, spaces, digits, underscores (_), periods (.), colons (:), backslashes (), equal signs (=), plus signs (+), minus signs (-), and at signs (@) are allowed.

Default Value: N/A

value

No

String

Definition: Resource tag value.

Constraints: N/A

Range: 0 to 255 characters. Only letters, spaces, digits, underscores (_), periods (.), colons (:), backslashes (), equal signs (=), plus signs (+), minus signs (-), and at signs (@) are allowed.

Default Value: N/A

Table 6 PrometheusConfig

Parameter

Mandatory

Type

Description

enable

No

Boolean

Definition: Whether to enable AOM integration.

Constraints: N/A

Range

  • true: AOM integration is enabled.

  • false: AOM integration is disabled.

Default Value: false

aom_prometheus_id

No

String

Definition: AOM Prometheus instance ID. You can obtain it from the AOM management console or by calling the API for listing AOM Prometheus instances.

Constraints: N/A

Range: 0 to 256 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

Default Value: N/A

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

id

String

Definition: Compute resource ID.

Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

name

String

Definition: Compute resource name.

Range: 1 to 63 characters. Only lowercase letters, digits, and hyphens (-) are allowed. It must start with a letter and end with a letter or digit.

description

String

Definition: Resource description.

Range: 0 to 512 characters.

charge_mode

String

Definition: Billing mode.

Range

  • postPaid: Pay-per-use.

  • prePaid: Yearly/monthly.

capacity

Array of ResourceCapacityItem objects

Definition: Compute resource capacity configuration, consisting of an array of ResourceCapacityItem objects. Each object defines the resource type, resource quantity, resource specification, resource ID, and other information.

tags

Array of Tag objects

Definition: Tag list, which consists of an array of Tag objects. Each object defines a tag key and tag value.

prometheus_config

PrometheusConfig object

Definition: Prometheus monitoring configuration.

update_time

String

Definition: Resource update time, in UTC, in ISO 8601 format, for example, 2025-01-10T03:37:12.000+00:00.

Range: N/A

create_time

String

Definition: Resource creation time, in UTC format, ISO 8601: yyyy-MM-dd'T'HH:mm:ss.SSSXXX. Example: 2025-01-10T03:37:12.000+00:00.

Range: N/A

status

String

Definition: Resource status.

Range

  • PREPARING: Creating.

  • RELEASING: Releasing.

  • RUNNING: Running.

  • SCALEIN: Scaling in.

  • SCALEOUT: Scaling out.

  • FREEZING: Freezing.

  • DELETED: Deleted.

  • DELETING: Deleting.

  • FAILED: Failed.

  • ORDER_PAYING: Order payment in progress.

creator

Creator object

Definition: Resource owner information.

error

Error object

Definition: Text message content returned on failure, including the error code and error description.

Table 8 ResourceCapacityItem

Parameter

Type

Description

type

String

Definition: Resource type.

Range

  • CPU: Central processing unit.

  • GPU: Graphics processing unit.

  • NPU: Neural processing unit.

capacity

Integer

Definition: Resource capacity quantity. The unit for CPU resources is cores, and the unit for GPU/NPU resources is instances.

Range: 0 to 48,000

spec_code

String

Definition: Specification code.

Range: 1 to 64 characters. Only letters, digits, hyphens (-), and periods (.) are allowed.

resource_id

String

Definition: Resource ID.

Range: 1 to 64 characters. Only letters, digits, hyphens (-), and periods (.) are allowed.

Table 9 Tag

Parameter

Type

Description

key

String

Definition: Tag key.

Range: 1 to 128 characters. Only letters, digits, underscores (_), hyphens (-), and periods (.) are allowed.

value

String

Definition: Tag value.

Range: 0 to 255 characters.

Table 10 PrometheusConfig

Parameter

Type

Description

enable

Boolean

Definition: Whether to enable AOM integration.

Range

  • true: AOM integration is enabled.

  • false: AOM integration is disabled.

aom_prometheus_id

String

Definition: AOM Prometheus instance ID. You can obtain it from the AOM management console or by calling the API for listing AOM Prometheus instances.

Range: 0 to 256 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

Table 11 Creator

Parameter

Type

Description

domain_name

String

Definition: Tenant name.

Range: 1 to 64 characters. Only letters, digits, and special characters are allowed.

domain_id

String

Definition: Tenant ID.

Range: 1 to 64 characters. Only letters, digits, and hyphens (-) are allowed.

user_name

String

Definition: Username.

Range: 1 to 64 characters. Only letters, digits, and underscores (_) are allowed.

user_id

String

Definition: User ID.

Range: 1 to 64 characters. Only letters, digits, and hyphens (-) are allowed.

Table 12 Error

Parameter

Type

Description

error_code

String

Definition: Error code on failure.

Range: 0 to 36 characters. Only letters, digits, periods (.), and underscores (_) are allowed.

error_msg

String

Definition: Error message on failure.

Range: 0 to 1,024 characters. Only letters, digits, and special characters are allowed.

Status code: 400

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 401

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 403

Table 15 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 404

Table 16 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 500

Table 17 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Example Requests

Create a compute resource. The name is compute-01, and the description is Test compute resource.

POST /v2/workspaces/{workspace_id}/computes

{
  "name" : "compute-01",
  "description" : "Test compute resource.",
  "capacity" : [ {
    "type" : "CPU",
    "capacity" : 8,
    "spec_code" : "aidatalake.cpu.x86.general.1c4g"
  } ],
  "charge_mode" : "postPaid",
  "tags" : [ {
    "key" : "test",
    "value" : "ai"
  } ]
}

Example Responses

Status code: 200

{
  "id" : "03141229-84cd-4b1b-9733-dd124320c125",
  "name" : "compute-01",
  "description" : "Test compute resource",
  "charge_mode" : "postPaid",
  "capacity" : [ {
    "type" : "CPU",
    "capacity" : 8,
    "spec_code" : "aidatalake.cpu.x86.general.1c4g",
    "resource_id" : "03141229-84cd-4b1b-9733-dd124320c125"
  } ],
  "tags" : [ {
    "key" : "test",
    "value" : "ai"
  } ],
  "update_time" : "2026-05-14T04:22:18.000+00:00",
  "create_time" : "2026-05-14T04:22:18.000+00:00",
  "status" : "PREPARING",
  "creator" : {
    "domain_name" : "domain_name",
    "domain_id" : "domain_id",
    "user_name" : "user_name",
    "user_id" : "user_id"
  },
  "error" : { }
}

Status code: 400

{
  "error_code" : "AIDataLake.00010151",
  "error_msg" : "Parameter value is invalid.",
  "solution_msg" : "Please input valid parameter value."
}

Status code: 401

{
  "error_code" : "APIGW.0301",
  "error_msg" : "Incorrect IAM authentication information: decrypt token fail.",
  "solution_msg" : "Check whether the IAM authentication information is correct."
}

Status code: 403

{
  "error_code" : "AIDataLake.00010150",
  "error_msg" : "The operation is not allowed.",
  "solution_msg" : "Check whether the operation is allowed in the current status."
}

Status code: 404

{
  "error_code" : "AIDataLake.00010009",
  "error_msg" : "No resources found.",
  "solution_msg" : "Ensure the requested resource exists and the parameters are correct."
}

Status code: 500

{
  "error_code" : "AIDataLake.00011001",
  "error_msg" : "Internal error.",
  "solution_msg" : "Contact technical support or try again later."
}

Status Codes

Status Code

Description

200

Request submitted.

400

Invalid request parameters.

401

Unauthorized.

403

Access denied.

404

Resource not found.

500

Internal server error.