CreateNetworkInterface

CreateNetworkInterface

1. API Description

This API is used to create an elastic vNIC.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

name

Yes

String

The name of the vNIC.

The length is 2 to 63 characters. Only letters, numbers, - and periods (.) are supported. The name must start and end with a number or a letter.

subnetId

Yes

String

ID of the subnet.

nicStackType

No

The IP stack type of the vNIC. If not specified, it will be determined by the subnet’s stack type: IPv4 for an IPv4 subnet, and IPv6 for an IPv6 subnet. Specify this parameter if you need IPv4_IPv6 vNIC IP stack type.

resourceGroupId

No

String

The resource group ID of the vNIC. If you do not specify a resource group, it is placed in the default resource group.

securityGroupId

No

String

ID of the security group deployed on the primary vNIC. Currently only one security group can be deployed. If not specified, the security group associated with global VPC will be used by default.

internetChargeType

No

String

Network billing model.

See InternetChargeType for available values. If the subnet stack type is IPv6 and the type is Public, this value is required.

bandwidth

No

Integer

Outbound public network bandwidth cap (Mbps). Unit: Mbps.

The value differs with different instance types. See bandwidth configuration for details.

packageSize

No

BigDecimal

Data transfer package size(TB).

The unit is TB.

This value takes effect only when internetChargeType is set to ByTrafficPackage.

The default value is 0. Maximum of one decimal place.

clusterId

No

String

Bandwidth cluster ID.

If the value of internetChargeType is BandwidthCluster , the parameter is required.

marketingOptions

No

Information on marketing campaigns.

tags

No

Bound tags when creating the image.

Tag keys must be unique.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

nicId

String

vNIC ID.

4. Code Example

Create an elastic vNIC.

POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateNetworkInterface
<Common Request Params>

Request:
{
  "name": "XXX",
  "subnetId": "xxx",
  "packageSize": 10,
  "internetChargeType": "ByTrafficPackage",
  "resourceGroupId": "xxxx"
}

Response:
{
  "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
  "response": {
    "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
    "nicId": "xxx"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

HTTP Status Code
Error Code
Description

404

INVALID_EIP_NOT_FOUND

Elastic IP does not exist.

404

INVALID_INSTANCE_NOT_FOUND

Instance does not exist.

400

INVALID_IP_BROADCAST_ADDRESS

IP is a broadcast address and cannot be used.

400

INVALID_IP_FIRST_ADDRESS

IP is a gateway address and cannot be used.

400

INVALID_IP_NETWORK_ADDRESS

IP is a network address and cannot be used.

409

INVALID_NIC_INSTANCE_REGION_MISMATCH

Instance and vNIC are not in the same zone.

400

INVALID_NIC_IPV6_EXISTS

vNIC already has an IPv6 assigned; operation not allowed.

400

INVALID_PARAMETER_BANDWIDTH_ERROR

Bandwidth size is below the minimum limit.

400

INVALID_PARAMETER_BANDWIDTH_EXCEED

Bandwidth size exceeds the maximum limit.

400

INVALID_PARAMETER_FLOW_TRAFFIC_PACKAGE

Data transfer package size is invalid.

400

INVALID_REGION_NOT_ON_SALE

The specified region is not available for sale.

404

INVALID_SECURITY_GROUP_NOT_FOUND

Security group does not exist.

409

INVALID_SUBNET_IPV4_INSUFFICIENT

Insufficient available IPv4 addresses in the subnet.

404

INVALID_SUBNET_NOT_FOUND

Subnet does not exist.

400

OPERATION_DENIED_EIP_IS_DEFAULT

Default public IP cannot be unbound.

400

OPERATION_DENIED_EIP_IS_NOT_UN_ASSIGN

Elastic IP is not in unassigned state.

403

OPERATION_DENIED_EIP_NIC_NOT_ADAPTER

Specified vNIC count does not match the number of elastic IPs to create.

400

OPERATION_DENIED_EIP_NOT_ASSIGNED

Elastic IP is not in bound state.

400

OPERATION_DENIED_EIP_NOT_SUPPORT_PASS_THROUGH_BIND_TYPE

Elastic IP mode does not support high-speed binding.

403

OPERATION_DENIED_INSTANCE_NIC_NOT_ADAPTER

Specified instance count does not match the number of vNICs to create.

400

OPERATION_DENIED_INSTANCE_STATUS_NOT_SUPPORT

Current instance state does not allow this operation.

403

OPERATION_DENIED_INTERNET_CHARGE_TYPE_NOT_SUPPORT

IP network billing type is not supported.

400

OPERATION_DENIED_SUBNET_TYPE_NOT_SUPPORT_IPV4

Subnet stack type does not include IPv4.

403

OPERATION_DENIED_STACK_TYPE_NOT_SUPPORT

Stack type is not supported.

Last updated