Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Elastic Cloud Server/ API Reference/ Data Structure/ Data Structure for Creating ECSs

Data Structure for Creating ECSs

Updated on 2024-12-19 GMT+08:00

Notes

ECS APIs can be of V1 or V1.1. V1 APIs can only be used to create pay-per-use ECSs, while V1.1 APIs can be used to create both pay-per-use and yearly/monthly ECSs.

For the fields described in this section, use V1.1 APIs for yearly/monthly ECSs.

publicip Field Description

This field is used by the following APIs:
  • Creating ECSs /v1/{project_id}/cloudservers
  • Creating ECSs: /v1.1/{project_id}/cloudservers
Table 1 publicip field description

Parameter

Mandatory

Type

Description

id

No

String

Specifies the ID of the existing EIP assigned to the ECS to be created. The value is in UUID format.

Only EIPs in DOWN state can be assigned.

eip

No

Object

Specifies an EIP that will be automatically assigned to an ECS.

For details, see Table 3.

delete_on_termination

No

Boolean

Specifies whether the EIP is released when the ECS where the EIP is bound is deleted.

  • true: The EIP is released when the ECS is deleted.
  • false: The EIP is not released when the ECS is deleted.

The default value is false.

NOTE:

This parameter is available only for pay-per-use EIPs.

NOTE:

Either id or eip in the publicip field can be configured.

security_groups Field Description

This field is used by the following APIs:

  • Creating ECSs /v1/{project_id}/cloudservers
  • Creating ECSs: /v1.1/{project_id}/cloudservers
Table 2 security_groups field description

Parameter

Mandatory

Type

Description

id

No

String

Specifies the ID of the security group to which an ECS is to be added. The configuration will take effect on the NICs of the ECS. You need to specify the ID of an existing security group in UUID format. Otherwise, the default security group will be used at the underlying layer.

eip Field Description

This field is used by the following APIs:
  • Creating ECSs /v1/{project_id}/cloudservers
  • Creating ECSs: /v1.1/{project_id}/cloudservers
Table 3 eip field description

Parameter

Mandatory

Type

Description

iptype

Yes

String

Specifies the EIP type.

For details, see the publicip field description in Assigning an EIP.

bandwidth

Yes

Object

Specifies the bandwidth of an EIP.

For details, see bandwidth Field Description.

extendparam

No

Object

Provides additional EIP information.

For details, see Table 6.

NOTE:

If chargingMode in the extendparam parameter of the created ECS is set to prePaid, the ECS is billed in yearly/monthly payments. This parameter is mandatory if a pay-per-use EIP is required. In such a case, chargingMode must be set to postPaid, indicating pay-per-use payments.

bandwidth Field Description

This field is used by the following APIs:
  • Creating ECSs /v1/{project_id}/cloudservers
  • Creating ECSs: /v1.1/{project_id}/cloudservers
Table 4 bandwidth field description

Parameter

Mandatory

Type

Description

size

No

Integer

Specifies the bandwidth size.

Specifies the bandwidth (Mbit/s). The value ranges from 1 to 300.

The specific range may vary depending on the configuration in each region. You can see the bandwidth range of each region on the management console.

The minimum increment for bandwidth adjustment varies depending on the bandwidth range.
  • The minimum increment is 1 Mbit/s if the allowed bandwidth ranges from 0 Mbit/s to 300 Mbit/s (with 300 Mbit/s included).
  • The minimum increment is 50 Mbit/s if the allowed bandwidth ranges from 300 Mbit/s to 1,000 Mbit/s (with 1,000 Mbit/s included).
  • The minimum increment is 500 Mbit/s if the allowed bandwidth is greater than 1,000 Mbit/s.
NOTE:

This parameter is mandatory when sharetype is set to PER and is optional when sharetype is set to WHOLE with an ID specified.

sharetype

Yes

String

Specifies the bandwidth sharing type.

Enumerated values: PER (indicates exclusive bandwidth) and WHOLE (indicates shared bandwidth)

chargemode

No

String

Specifies the bandwidth billing mode.

  • If the field value is traffic, the ECS is billed by traffic.
  • If the field value is others, creating the ECS will fail.

id

No

String

Specifies the bandwidth ID. You can use an existing shared bandwidth when applying for an EIP for the bandwidth of type WHOLE.

Value: ID of the bandwidth of type WHOLE

NOTE:

This parameter is mandatory when sharetype is set to WHOLE.

ipv6_bandwidth Field Description

This field is used by the following APIs:
  • Creating ECSs /v1/{project_id}/cloudservers
  • Creating ECSs: /v1.1/{project_id}/cloudservers
Table 5 ipv6_bandwidth field description

Parameter

Mandatory

Type

Description

id

No

String

Specifies the ID of an IPv6 bandwidth.

extendparam Field Description for Assigning EIPs

This field is used by the following API:

Creating ECSs /v1.1/{project_id}/cloudservers

Table 6 extendparam field description for assigning EIPs

Parameter

Mandatory

Type

Description

chargingMode

No

String

Specifies the billing mode of an EIP.

Options:

  • prePaid: indicates the yearly/monthly billing mode.
  • postPaid: indicates the pay-per-use billing mode.
    NOTE:

    If sharetype in the bandwidth parameter with an ID specified is set to WHOLE, only pay-per-use EIPs are allowed and parameter prePaid is unavailable.

extendparam Field Description for Creating Disks

This field is used by the following APIs:

  • Creating ECSs /v1/{project_id}/cloudservers
  • Creating ECSs: /v1.1/{project_id}/cloudservers
Table 7 extendparam field description for creating disks

Parameter

Mandatory

Type

Description

resourceSpecCode

No

String

Specifies the code of the disk specifications, such as SATA, SAS, or SSD.

NOTE:

This field has been discarded.

resourceType

No

String

Specifies the resource type.

NOTE:

This field has been discarded.

snapshotId

No

String

Specifies the snapshot ID or ID of the original data disk contained in the full-ECS image.

Application scenarios:

This parameter is used if an ECS is created using a full-ECS image, and the image contains one or more data disks.

If you use a full-ECS image to create an ECS, the system automatically restores the data type and data from the data disks in the image. The snapshotId parameter allows you to specify the disk type for the original data disk after restoration.

NOTE:
  • You are advised to specify snapshotId for each original data disk.
  • If you are required to change a disk size, ensure that the changed disk size is greater than or equal to the size of the original data disk. Otherwise, restoring data of the original data disk will fail.
  • To set disk sharing, you need to specify the sharing attribute.
  • To set disk encryption, you need to specify the encryption attribute in the metadata field.

Working rules:

snapshotId uniquely identifies an original data disk contained in a full-ECS image. You can use snapshotId to obtain the information of the original data disk for data restoration.

Obtaining snapshotId through the management console:

Log in to the management console, choose Elastic Volume Service > Snapshot. Then, use the name of the original data disk to find the snapshot ID or the original disk ID.

Obtaining snapshotId through the API:

If you have obtained the full-ECS image ID, obtain the Cloud Backup and Recovery (CBR) or Cloud Server Backup Service (CSBS) backup ID associated with the full-ECS image ID by following the instructions provided in the API for querying image details.
  • If CBR backup is used, use the CBR backup ID to obtain the backup. The resource_id or snapshot_id contained in the children field in the response is the desired snapshotId. For details, see the API for "Querying a Specified Backup" in Cloud Backup and Recovery User Guide.
  • If CSBS backup is used, use the CSBS backup ID to obtain the backup. The source_volume_id or snapshot_id contained in the volume_backups field in the response is the desired snapshotId. For details, see the API for "Querying a Single Backup" in Cloud Server Backup Service User Guide.

extendparam Field Description for Creating ECSs

This field is used by the following APIs:
  • Creating ECSs /v1/{project_id}/cloudservers
  • Creating ECSs: /v1.1/{project_id}/cloudservers
Table 8 extendparam field description for creating ECSs (for V1 APIs)

Parameter

Mandatory

Type

Description

chargingMode

No

Integer

Specifies the billing mode.

  • 0: indicates the pay-per-use billing mode. The default value is 0.

regionID

No

String

Specifies the ID of the region where the ECS resides.

See Regions and Endpoints.

support_auto_recovery

No

Boolean

Specifies whether automatic recovery is enabled on the ECS.

  • true: enables this function.
  • false: disables this function.
NOTE:

This parameter is of boolean type. If a non-boolean character is imported, the parameter value is set to false.

  • When support_auto_recovery is set to false and "cond:compute": autorecovery is unavailable in the flavor, automatic recovery is not supported.
  • When support_auto_recovery is set to false and "cond:compute": autorecovery is available in the flavor, automatic recovery is supported.

You can query whether "cond:compute": autorecovery is available in the flavor by referring to Querying Details About Flavors and Extended Flavor Information.

enterprise_project_id

No

String

Specifies the enterprise project ID.

NOTE:

For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Management User Guide.

If this parameter is not specified or is set to 0, resources will be bound to the default enterprise project.

marketType

No

String

Specifies a spot ECS. When creating a spot ECS, set the parameter value to spot.

NOTE:

This parameter takes effect only when chargingMode is set to 0 and marketType is set to spot.

spotPrice

No

String

Specifies the highest price per hour you accept for a spot ECS.

NOTE:
  • This parameter takes effect only when chargingMode is set to 0 and marketType is set to spot.
  • When chargingMode is set to 0 and marketType is set to spot, if the spotPrice parameter is not specified, the pay-per-use price is used by default.
  • The spotPrice value must be less than or equal to the pay-per-use price and greater than or equal to the ECS market price.

diskPrior

No

String

Specifies whether to support the function of creating a disk and then ECS.

  • true: enables this function.
  • false: disables this function.

spot_duration_hours

No

Integer

Specifies the predefined duration of the spot ECS.

NOTE:
  • This parameter is mandatory for spot block ECSs and is valid only when interruption_policy is set to immediate.
  • The spot_duration_hours value must be greater than zero. Its maximum value is automatically set by the system and can be obtained from the cond:spot_block:operation:longest_duration_hours field of flavor parameter extra_specs.

spot_duration_count

No

Integer

Specifies the number of durations.

NOTE:
  • This parameter is mandatory for spot block ECSs and is valid only when spot_duration_hours is greater than 0.
  • If spot_duration_hours is set to a value smaller than 6, spot_duration_count must be 1.
  • If spot_duration_hours is set to 6, spot_duration_count must be greater than or equal to 1.

    The maximum value of spot_duration_count is automatically set by the system and can be obtained from the cond:spot_block:operation:longest_duration_count field of flavor parameter extra_specs.

interruption_policy

No

String

Specifies the spot ECS interruption policy. The parameter can only be set to immediate currently, meaning that the spot ECSs are released immediately.

NOTE:

This parameter must be set to immediate for spot block ECSs.

CB_CSBS_BACKUP

No

String

Specifies a CSBS policy ID and CSBS vault ID.

For example, a CSBS policy ID obtained on the console is fdcaa27d-5be4-4f61-afe3-09ff79162c04.

A CSBS vault ID is 332a9408-463f-436a-9e92-78dad95d1ac4.

The CB_CSBS_BACKUP value is "{\"policy_id\":\"fdcaa27d-5be4-4f61-afe3-09ff79162c04\",\"vault_id\":\"332a9408-463f-436a-9e92-78dad95d1ac4\"}".

Table 9 extendparam field description for creating ECSs (for V1.1 APIs)

Parameter

Mandatory

Type

Description

chargingMode

No

String

Specifies the billing mode.

Options:

  • prePaid: indicates the yearly/monthly billing mode.
  • postPaid: indicates the pay-per-use billing mode.
  • The default value is postPaid.
    NOTE:

    When chargingMode is set to prePaid (indicating that the created ECS is billed in yearly/monthly payments) and the ECS is logged in using an SSH key, op_svc_userid in metadata is mandatory.

    For details about the value of op_svc_userid in metadata, see Table 11.

regionID

No

String

Specifies the ID of the region where the ECS resides.

See Regions and Endpoints.

periodType

No

String

Specifies the subscription period.

Options:

  • month: indicates that the subscription is in the unit of month.
  • year: indicates that the subscription is in the unit of year.
    NOTE:

    This parameter is valid and mandatory if chargingMode is set to prePaid.

periodNum

No

Integer

Specifies the number of subscription periods.

Options:

  • If periodType is month, the value ranges from 1 to 9.
  • If periodType is year, the value ranges from 1 to 3.
NOTE:
  • This parameter is valid and mandatory if chargingMode is set to prePaid.
  • The parameter value must be a positive integer.
  • According to Huawei Cloud ECS pricing rules, the price of a one-year ECS (yearly) is equal to the price of a 10-month ECS (monthly). If you need to purchase a monthly ECS for more than nine months, it is a good choice to purchase a yearly ECS.

isAutoRenew

No

String

Specifies whether auto renew is enabled.

  • true: indicates that auto renew is enabled.
  • false: indicates that auto renew is disabled.
    NOTE:

    This parameter is valid when chargingMode is set to prePaid. If this parameter is not specified, auto renew is disabled by default.

isAutoPay

No

String

Specifies whether the order is automatically or manually paid.

  • true: The order will be automatically paid.
  • false: The order must be manually paid.
NOTE:

This parameter is valid when chargingMode is set to prePaid. If this parameter is not specified, the order must be manually paid by default.

enterprise_project_id

No

String

Specifies the enterprise project ID.

NOTE:

For more information about enterprise projects and how to obtain enterprise project IDs, see Enterprise Management User Guide.

If this parameter is not specified or is set to 0, resources will be bound to the default enterprise project.

support_auto_recovery

No

Boolean

Specifies whether to enable automatic ECS recovery.

  • true: enables this function.
  • false: disables this function.
NOTE:

This parameter is of boolean type. If a non-boolean character is imported, the parameter value is set to false.

marketType

No

String

Specifies a spot ECS. When creating a spot ECS, set the parameter value to spot.

NOTE:

This parameter takes effect only when chargingMode is set to postPaid and marketType is set to spot.

spotPrice

No

String

Specifies the highest price per hour you are willing to pay for a spot ECS.

NOTE:
  • This parameter takes effect only when chargingMode is set to postPaid and marketType is set to spot.
  • When chargingMode is set to postPaid and marketType is set to spot, if the spotPrice parameter is not specified or specified to null, the pay-per-use price is used by default.
  • The spotPrice value must be less than or equal to the pay-per-use price and greater than or equal to the ECS market price.

diskPrior

No

String

Specifies whether to support the function of creating a disk and then ECS.

  • true: enables this function.
  • false: disables this function.

spot_duration_hours

No

Integer

Specifies the predefined duration of the spot ECS.

NOTE:
  • This parameter is mandatory for spot block ECSs and is valid only when interruption_policy is set to immediate.
  • The spot_duration_hours value must be greater than zero. Its maximum value is automatically set by the system and can be obtained from the cond:spot_block:operation:longest_duration_hours field of flavor parameter extra_specs.

spot_duration_count

No

Integer

Specifies the number of durations.

NOTE:
  • This parameter is mandatory for spot block ECSs and is valid only when spot_duration_hours is greater than 0.
  • If spot_duration_hours is set to a value smaller than 6, spot_duration_count must be 1.
  • If spot_duration_hours is set to 6, spot_duration_count must be greater than or equal to 1.

    The maximum value of spot_duration_count is automatically set by the system and can be obtained from the cond:spot_block:operation:longest_duration_count field of flavor parameter extra_specs.

interruption_policy

No

String

Specifies the spot ECS interruption policy. The parameter can only be set to immediate currently, meaning that the spot ECSs are released immediately.

NOTE:

This parameter must be set to immediate for spot block ECSs.

CB_CSBS_BACKUP

No

String

Specifies a CSBS policy ID and CSBS vault ID.

For example, a CSBS policy ID obtained on the console is fdcaa27d-5be4-4f61-afe3-09ff79162c04.

A CSBS vault ID is 332a9408-463f-436a-9e92-78dad95d1ac4.

The CB_CSBS_BACKUP value is "{\"policy_id\":\"fdcaa27d-5be4-4f61-afe3-09ff79162c04\",\"vault_id\":\"332a9408-463f-436a-9e92-78dad95d1ac4\"}".

metadata Field Description for Creating Disks

This field is used by the following APIs:

  • Creating ECSs /v1/{project_id}/cloudservers
  • Creating ECSs: /v1.1/{project_id}/cloudservers
NOTE:
  • When you create an ECS, both root_volume and data_volume contain the metadata field.
Table 10 metadata field description for creating disks

Parameter

Mandatory

Type

Description

__system__encrypted

No

String

Specifies encryption in metadata. The value can be 0 (encryption disabled) or 1 (encryption enabled).

If this parameter does not exist, the disk will not be encrypted by default.

__system__cmkid

No

String

Specifies the CMK ID, which indicates encryption in metadata. This parameter is used with __system__encrypted.

NOTE:

For details about how to obtain the CMK ID, see Querying the Key List.

metadata Field Description for Creating ECSs

This field is used by the following APIs:

  • Creating ECSs /v1/{project_id}/cloudservers
  • Creating ECSs: /v1.1/{project_id}/cloudservers
Table 11 metadata reserved field description

Parameter

Mandatory

Type

Description

op_svc_userid

No

String

Specifies the user ID.

You can obtain the value of this parameter from IAM User ID on the My Credentials > API Credentials page. For details, see API Credentials.

NOTE:

The value of this parameter is that of IAM User ID of the current login account. If you log in as an IAM user, obtain the IAM user ID of that IAM user.

agency_name

No

String

Specifies the IAM agency name.

An agency is created by a tenant administrator on Identity and Access Management (IAM) to provide temporary credentials for ECSs to access cloud services.

BYOL

No

String

If you have an OS or a software license (a license certified based on the number of physical servers and cores), you can migrate your services to the cloud platform using bring your own license (BYOL) model to continue using your existing licenses.
  • true: Use your existing licenses.
  • Other values are invalid and an error will be reported.

os:scheduler_hints Field Description

This field is used by the following APIs:
  • Creating ECSs: /v1/{project_id}/cloudservers
  • Creating ECSs: /v1.1/{project_id}/cloudservers
  • Creating ECSs (native): /v2.1/{project_id}/servers
Table 12 os:scheduler_hints field description (request parameters)

Parameter

Mandatory

Type

Description

group

No

String

Specifies the ECS group ID in UUID format.

Obtain the parameter value from the console or by referring to Querying ECS Groups.

NOTE:

Ensure that the ECS group uses the anti-affinity policy.

tenancy

No

String

Creates ECSs on a dedicated or shared host.

The value of this parameter can be dedicated or shared.

dedicated_host_id

No

String

Specifies the dedicated host ID.

NOTE:

A DeH ID takes effect only when tenancy is set to dedicated.

Table 13 os:scheduler_hints field description (response parameters)

Parameter

Type

Description

group

Array of strings

Specifies the ECS group ID in UUID format.

Obtain the parameter value from the console or by referring to Querying ECS Groups.

tenancy

Array of strings

Creates ECSs on a dedicated or shared host.

The value of this parameter can be dedicated or shared.

dedicated_host_id

Array of strings

Specifies the dedicated host ID.

NOTE:

A DeH ID takes effect only when tenancy is set to dedicated.

server_tags Field Description

This field is used by the following APIs:
  • Creating ECSs: /v1/{project_id}/cloudservers
  • Creating ECSs: /v1.1/{project_id}/cloudservers
Table 14 server_tags field description

Parameter

Mandatory

Type

Description

key

Yes

String

Specifies the tag key.

The key can contain a maximum of 36 Unicode characters. It cannot be left blank, or contain ASCII (0-31) or the following characters: =*<>\,|/

The tag key of an ECS must be unique.

value

Yes

String

Specifies the tag value.

The value can contain a maximum of 43 Unicode characters and can be left blank. It cannot contain ASCII (0-31) or the following characters: =*<>\,|

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback