Updated on 2024-08-09 GMT+08:00

Purchasing a Cloud Phone Server

Function

When purchasing a cloud phone server, you can reuse existing VPCs, shared bandwidth, and other resources that you have purchased.

  • Ensure that VPCs are available. You need to specify an existing VPC when creating a cloud phone server, or the server cannot be created. In addition, ensure that your account has at least the VPC ReadOnlyAccess permissions so that VPC resources can be selected.

  • Ensure that your account has successfully created key pairs and has the ecs:serverKeypairs:list fine-grained permissions for querying the key pairs. Creating a key pair requires the ecs:serverKeypairs:create permissions.

  • Ensure that an agency with Agency Name set to cph_admin_trust, Agency Type to Cloud service, and cloud service set to Cloud Phone Host (CPH) is available. The agency has the VPC FullAccess permissions and allows CPH to call cloud services. If the agency creation or permission verification fails, the cloud phone server will fail to be created.

  • Ensure that your account has the Security Administrator permissions.

  • Ensure that your quotas for cloud phone servers and networking resources have not been reached. If the quota verification fails, the cloud phone server will fail to be created.

URI

POST /v2/{project_id}/cloud-phone/servers

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token. It can be obtained by calling an Identity and Access Management (IAM) API. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

server_name

Yes

String

Specifies the name of the cloud phone server.The name can contain a maximum of 60 characters, including only letters, digits, underscores (_), and hyphens (-).If you purchase multiple cloud phone servers at a time, the system automatically adds a sequence number suffix to the end of each server name. For example, if you set server_name to server-1, the name of the first cloud phone server will be server-1-0001, and the name of the second cloud phone server will be server-1-0002.

server_model_name

Yes

String

Specifies the flavor of the cloud phone server. The flavor can contain a maximum of 64 bytes.

phone_model_name

Yes

String

Specifies the cloud phone flavor, which contains a maximum of 64 bytes.

image_id

Yes

String

Specifies the cloud phone image ID, which can contain a maximum of 32 bytes.

count

Yes

Integer

Specifies the number of cloud phone servers that can be purchased. A maximum of 10 cloud phone servers can be purchased.

keypair_name

No

String

Specifies the key pair name. The name can contain a maximum of 64 bytes and is used for logging in to the cloud phone through ADB.

ports

No

Array of Port objects

Specifies the application port enabled on the cloud phone. The CPH service forwards requests to and from the port.

extend_param

Yes

extend_param object

Specifies parameters related to the billing mode.

tenant_vpc_id

Yes

String

Specifies the ID of the VPC you select for the cloud phone server to be created. The VPC ID is in UUID format.

nics

Yes

Array of Nic objects

Specifies the structure of the NIC you customized, which defines the NIC information of the cloud phone server to be created.

public_ip

Yes

public_ip object

Indicates the EIP structure customized by the tenant.

Specifies the method of configuring the EIP of the ECS,

Automatically assigned. You need to specify the information about the new EIP. If you use an existing EIP, you need to specify the EIP ID that has been [created] (tag:fcs) [purchased] (tag:hws,hws_hk,cmcc).

phone_count_per_ip

No

Integer

Number of mobile phones that share a VIP. The default value is the number of mobile phones, indicating that all mobile phones share one VIP. The value ranges from 1 to the number of mobile phone specifications.

phone_data_volume

No

phone_data_volume object

Mobile phone disk structure. This parameter is mandatory for 2.0 specifications.

server_share_data_volume

No

server_share_data_volume object

Shared storage disk structure. This parameter is optional for 2.0 specifications.

band_width

Yes

band_width object

Specifies the bandwidth used by the cloud phone.

availability_zone

No

String

Specifies the AZ where the cloud phone server to be created is located. You need to specify the AZ name. For example, the name for AZ 1 in the CN East-Shanghai1 region is cn-east-3a.

Table 4 Port

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the application port name, which can contain a maximum of 16 bytes. The key service name cannot be adb or vnc.

listen_port

Yes

Integer

Specifies the port number, which ranges from 10000 to 50000.

internet_accessible

Yes

String

Specifies whether internet_accessible is enabled. When internet_accessible is set to true (case insensitive), you can access cloud phones over this port from the Internet. Otherwise, you cannot access cloud phones over this port from the Internet.

Table 5 extend_param

Parameter

Mandatory

Type

Description

charging_mode

Yes

Integer

Billing mode, -0: duration-based [- 1: pay-per-use](tags: fcs)

period_type

Yes

Integer

Specifies the subscription period.

  • 2: month

  • 3: year

period_num

Yes

Integer

Number of subscription periods. If the subscription period is a month, the value ranges from 1 to 9. If the subscription period is a year, the value ranges from 1 to 10.

is_auto_pay

No

Integer

Specifies whether to automatically pay fees. By default, automatic payment is disabled.

  • 1: automatic payment

  • 0: no

is_auto_renew

No

Integer

Specifies whether auto renew is enabled. By default, auto renewal is disabled.

  • 1: automatic renewal

  • 0: no

enterprise_project_id

No

String

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

Table 6 Nic

Parameter

Mandatory

Type

Description

subnet_id

Yes

String

Specifies the ID of the subnet you specified, which is the subnet where you will deploy your cloud phone server.

The value must be the ID of the subnet created in the VPC (tenant_vpc_id) and in UUID format.

ipv6_enable

No

Boolean

Specifies whether the NIC supports IPv6 addresses.

If this parameter is set to true, the NIC supports IPv6 addresses.

ipv6_bandwidth

No

ipv6_bandwidth object

Specifies the shared bandwidth bound to the NIC IPv6 addresses. For details, see the ipv6_bandwidth data structure.

Table 7 ipv6_bandwidth

Parameter

Mandatory

Type

Description

band_width_id

Yes

String

Specifies the ID of the shared bandwidth bound to the NIC IPv6 addresses.

Table 8 public_ip

Parameter

Mandatory

Type

Description

ids

No

Array of strings

Specifies the ID of the existing EIP selected for creating the cloud phone server. Only one existing EIP ID can be specified.

eip

No

eip object

Specifies the parameter for an EIP that will be automatically assigned. For details, see the EIP structure.

count

No

Integer

Number of EIPs. The default value is 1. If no EIP is required, set this parameter to 0. The value ranges from 0 to the number of mobile phone IP addresses.

Table 9 eip

Parameter

Mandatory

Type

Description

type

Yes

String

EIP type.

  • 5_telcom: China Telecom

  • 5_union: China Unicom

  • 5_bgp: dynamic BGP

  • 5_sbgp: static BGP

Table 10 phone_data_volume

Parameter

Mandatory

Type

Description

volume_type

Yes

String

Specifies the disk type. Only the following types are supported:

  • SSD

  • GPSSD

size

Yes

Integer

Specifies the cloud phone disk size, in GiB. The value ranges from 10 GiB to 32,768 GiB.

Table 11 server_share_data_volume

Parameter

Mandatory

Type

Description

volume_type

Yes

String

Specifies the disk type. Only the following types are supported:

  • SSD

  • GPSSD

size

Yes

Integer

Specifies the shared storage size on the cloud phone server, in GiB. The value ranges from 10 GiB to 32,768 GiB.

Table 12 band_width

Parameter

Mandatory

Type

Description

band_width_id

No

String

Specifies the unique identifier of the bandwidth used by the cloud phone server.

band_width_size

No

Integer

Specifies the bandwidth size of the cloud phone server.

band_width_charge_mode

Yes

Integer

Specifies the billing mode of the cloud phone server bandwidth.

  • 0: bandwidth (charged by bandwidth)

  • 1: traffic (charged by traffic)

band_width_share_type

Yes

Integer

Specifies the bandwidth type of the cloud phone server.

  • 0: per, exclusive bandwidth

  • 1: whole, shared bandwidth

Response Parameters

Status code: 200

Table 13 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the unique request ID.

order_id

String

Specifies the order ID, which can contain a maximum of 64 bytes.

product_id

String

Specifies the product ID, which can contain a maximum of 64 bytes.

server_ids

Array of strings

Specifies the server ID list.

Example Requests

Purchasing a cloud phone server

POST https://{CPH Endpoint}/v2/{project_id}/cloud-phone/servers

{
  "server_name" : "cph-kertus-1110",
  "server_model_name" : "physical.kg1.4xlarge.cp",
  "phone_model_name" : "kg1.cp.c20.d64SSD.e1v1",
  "image_id" : "20060220200717f201120a2300000e91",
  "count" : 1,
  "keypair_name" : "keypair",
  "ports" : [ {
    "name" : "myServer1",
    "listen_port" : 20000,
    "internet_accessible" : "false"
  }, {
    "name" : "myServer2",
    "listen_port" : 20001,
    "internet_accessible" : "true"
  } ],
  "extend_param" : {
    "charging_mode" : 0,
    "period_type" : 2,
    "period_num" : 1,
    "is_auto_pay" : 0
  },
  "tenant_vpc_id" : "fca063f6-b942-42a8-9004-e5545f58d6a2",
  "nics" : [ {
    "subnet_id" : "f1cbfc37-eb42-4357-a0ec-9e4f11950908"
  } ],
  "public_ip" : {
    "eip" : {
      "type" : "5_bgp"
    }
  },
  "band_width" : {
    "band_width_share_type" : 0,
    "band_width_size" : 300,
    "band_width_charge_mode" : 1
  }
}

Example Responses

Status code: 200

OK

{
  "request_id" : "1564567b8bab40f34711234cb80d8574",
  "order_id" : "CS1710111105S8IPB",
  "product_id" : "00301-25217-0--0",
  "server_ids" : [ "1234567b8bab40ffb711234cb80d0234", "1678567b8bab40f93711234cb80d0764" ]
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.