CreateNetworkInterface

Last updated: 2018-10-12 16:15:54

1. API Description

Domain name for API request: vpc.tencentcloudapi.com.

This API (CreateNetworkInterface) is used to create ENIs.

  • When creating an ENI, you can specify private IPs, including a primary IP, for it. The specified private IPs must be in the same subnet as the ENI, and cannot be in use.
  • You can specify the number of the private IPs you want to apply for. The private IPs will be generated by the system randomly.
  • You can bind an existing security group to the ENI.

A maximum of 100 requests can be initiated per second for this API.

Note: This API supports Finance regions. Since Finance regions and non-Finance regions are isolated and not interconnected. If the common parameter Region is a Finance region (such as ap-shanghai-fsi), you need to specify a domain name containing the Finance region that should be identical to the value of Region field, for example: vpc.ap-shanghai-fsi.tencentcloudapi.com.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: CreateNetworkInterface
Version Yes String Common parameter. The value used for this API: 2017-03-12
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
VpcId Yes String VPC instance ID. You can obtain the parameter value from the VpcId field value in the returned result of API DescribeVpcs.
NetworkInterfaceName Yes String ENI name, which is limited to 60 characters.
SubnetId Yes String Subnet instance ID of ENI. For example: subnet-0ap8nwca.
NetworkInterfaceDescription No String ENI description, which is limited to 60 characters.
SecondaryPrivateIpAddressCount No Integer Number of new private IPs.
SecurityGroupIds.N No Array of String Specifies the security group to be bound with, such as ['sg-1dd51d'].
PrivateIpAddresses.N No Array of PrivateIpAddressSpecification Specifies the private IP information.

3. Output Parameters

Parameter Name Type Description
NetworkInterface NetworkInterface ENI instance.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Error Codes

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

Error Code Description
InvalidParameterValue.LimitExceeded The parameter value exceeds the limit.
InvalidParameterValue.Malformed Invalid input parameter format.
InvalidParameterValue.Range The parameter value is not in the specified range.
InvalidParameterValue.Reserved The parameter value is retained by the system.
LimitExceeded Quota exceeded.
ResourceNotFound Resource does not exist.

5. Example

Example 1: Create an ENI

Input example

https://vpc.tencentcloudapi.com/?Action=CreateNetworkInterface
&Version=2017-03-12
&VpcId=vpc-0akbol5v
&SubnetId=subnet-76r802pg
&NetworkInterfaceName=TestNIC
&NetworkInterfaceDescription=TestDesc
&PrivateIpAddresses.0.PrivateIpAddress=172.16.64.13
&PrivateIpAddresses.0.Primary=true
&SecondaryPrivateIpAddressCount=1
&SecurityGroupIds.0=sg-05bb4upy
&<Common request parameters>

Output example

{
  "Response": {
    "NetworkInterface": {
      "Attachment": {},
      "MacAddress": "20:90:6F:62:33:E2",
      "NetworkInterfaceDescription": "TestDesc",
      "NetworkInterfaceId": "eni-irk5qhhl",
      "NetworkInterfaceName": "TestNIC",
      "PrivateIpAddressSet": [
        {
          "Primary": true,
          "PrivateIpAddress": "172.16.64.13"
        }
      ],
      "State": "PENDING",
      "SubnetId": "subnet-76r802pg",
      "VpcId": "vpc-0akbol5v"
    },
    "RequestId": "5cf1a813-d4f8-4e0c-8f90-c155a84a3ea1"
  }
}

6. Other Resources

Cloud API 3.0 comes with the following development tools to make it easier to call the API.