Updated on 2026-05-21 GMT+08:00

Creating an ECS

Function

API for creating an ECS.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    workspace:server:create

    Write

    server *

    -

    -

    • ims:images:list
    • ims:images:updateMemberStatus
    • ims:images:share
    • ims:images:get
    • vpc:securityGroups:get
    • vpc:securityGroupRules:get
    • vpc:networks:get
    • vpc:subnets:get
    • vpc:ports:create
    • vpc:ports:get
    • vpc:ports:delete
    • vpc:vpcs:get
    • dss:pools:list

    serverGroup *

    -

    -

    • g:RequestTag/<tag-key>

    • g:TagKeys

    • g:EnterpriseProjectId

URI

POST /v1/{project_id}/app-servers/actions/create

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Unique ID of a project

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

X-Linked-Id

No

String

Associated ID delivered when the transaction component is invoked.

Service-Transaction-Id

No

String

Service ID contained in the request header during CBC API callback. This parameter is mandatory for yearly/monthly billing, and is not specified for pay-per-use billing.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

type

Yes

String

Type of the cloud service to be created. Option: createApps, which indicates cloud application.

server_group_id

Yes

String

Unique ID of a server group.

availability_zone

No

String

AZ.

NOTE:
  • Creates the service in a specified AZ. If no AZ is specified, a randomly selected AZ will be used. Creates the service in a specified AZ.

  • For details about AZs, see ListAvailabilityZone: "GET /v1/{project_id}/availability-zone". For details about AZs, see ListAvailabilityZone: "GET /v1/{project_id}/availability-zone/summary".

subscription_num

Yes

Integer

Number of subscriptions.

nics

No

Array of Nic objects

Service NIC information. This field is reserved.

ou_name

No

String

OU name, which is used for connecting to the AD. An OU must be created in the AD in advance.

product_id

Yes

String

Product ID

NOTE:
  • For details, see ListProduct: "GET /v1/{project_id}/product".

flavor_id

No

String

Specification ID.

os_type

No

String

OS type. Only Windows is supported.

root_volume

Yes

Volume object

System disk: disk capacity (a multiple of 10, max. 1024 GB).

scheduler_hints

No

WdhParam object

Dedicated hosts support only pay-per-use billing, but not yearly/monthly billing.

subnet_id

Yes

String

ID of the NIC subnet.

vpc_id

Yes

String

VPC ID

update_access_agent

No

Boolean

Indicates whether to enable automatic HDA upgrade.

create_server_extend_param

No

CreateServerExtendParam object

Extended parameters for creating a cloud server.

Table 4 Nic

Parameter

Mandatory

Type

Description

ip_address

No

String

IP address.

subnet_id

No

String

ID of the NIC subnet.

Table 5 Volume

Parameter

Mandatory

Type

Description

type

Yes

String

Disk type. For details about how to obtain available disk types, see parameter ListVolumeType. Options:

ESSD: Extreme SSD

SSD: Ultra-high I/O

GPSSD: General-purpose SSD

SAS: High I/O

SATA: Common I/O

size

Yes

Integer

Disk capacity (a multiple of 10, in GB). Options:

  • System disk: minLength: 10; maxLength: 1024

  • Data disk: minLength: 10; maxLength: 32768.

cluster_id

No

String

ID of the storage pool used by the ECS system disk.

Table 6 WdhParam

Parameter

Mandatory

Type

Description

dedicated_host_id

No

String

Workspace host ID.

tenancy

No

String

Dedicated host type. Currently, only dedicated is supported. Options include dedicated and shared.

Table 7 CreateServerExtendParam

Parameter

Mandatory

Type

Description

charging_mode

No

String

Billing mode. Options:

prePaid: yearly/monthly

postPaid: pay-per-use

period_type

No

Integer

Period type. The value 2 indicates monthly and 3 indicates yearly. This parameter must be specified when chargingMode is set to prePaid.

period_num

No

Integer

Number of subscription periods, which is a positive integer. This parameter is required when chargingMode is set to prePaid.

NOTE:
  • If periodType is 2 (monthly), the value ranges from 1 to 9.

  • If periodType is 3 (yearly), the value ranges from 1 to 3.

is_auto_renew

No

Boolean

Whether to enable automatic renewal. Options:

NOTE:
  • false (default if empty): disable

  • true: enable

is_auto_pay

No

Boolean

Whether the order is automatically or manually paid. This parameter is available if chargingMode is set to prePaid.

NOTE:
  • true: automatic payment

  • false (default if empty): manual payment

Response Parameters

Status code: 200

Table 8 Response body parameters

Parameter

Type

Description

job_id

String

A job_id is returned after the pay-per-use application streaming server creation starts, and can be used for querying the task status. A job_id is returned after the pay-per-use application streaming server creation starts, and can be used for querying the task status.

order_id

String

Order ID, which is returned after the yearly/monthly ECS creation starts.

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 401

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 403

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 404

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 405

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 500

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 503

Table 15 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Example Requests

POST /v1/a4da8115c9d8464ead3a38309130523f/app-servers/actions/create

{
  "availability_zone" : "cn-north-5a",
  "subnet_id" : "085ca7d8-4474-4c32-bff0-31254d98c4a9",
  "nics" : [ {
    "subnet_id" : "085ca7d8-4474-4c32-bff0-31254d98c4a9"
  } ],
  "product_id" : "workspace.appstream.general.xlarge.2",
  "flavor_id" : "c3.large.4",
  "os_type" : "Windows",
  "root_volume" : {
    "type" : "SAS",
    "size" : 80
  },
  "server_group_id" : "f309fa65-881a-4f49-8c06-31e20437ae20",
  "vpc_id" : "d987ecf7-c6a4-4753-8b66-135dcc3eed79",
  "ou_name" : "",
  "update_access_agent" : false,
  "type" : "createApps",
  "subscription_num" : 1,
  "create_server_extend_param" : {
    "charging_mode" : "prePaid",
    "period_type" : 3,
    "period_num" : 2,
    "is_auto_renew" : false,
    "is_auto_pay" : false
  }
}

Example Responses

Status code: 200

Response to a successful request.

{
  "job_id" : "575768277444198400",
  "order_id" : "CS2310081912FP1MC"
}

Status Codes

Status Code

Description

200

Response to a successful request.

400

The request cannot be understood by the server due to malformed syntax.

401

Authentication failed.

403

Permissions required.

404

Resources not found.

405

The method specified in the request is not allowed.

500

An internal service error occurred. For details, see the error code description.

503

Service unavailable.

Error Codes

See Error Codes.