Create ENIs

Last updated: 2017-12-26 15:45:55

PDF

1. API Description

This API (CreateNetworkInterface) is used to create ENIs.
Domain for API request: vpc.api.qcloud.com

1) When creating an ENI, you can specify a private IP and a primary IP. The specified private IP must be in the subnet of the ENI, and cannot be occupied.
2) When creating an ENI, you can specify the number of private IP addresses that need to be requested. The system will randomly generate the private IP address(es).
3) You can bind an existing security group when creating an ENI.

2. Input Parameters

The following request parameter list only provides API request parameters. Common request parameters need to be added when the API is called. For more information, refer to Common Request Parameters. The Action field for this API is CreateNetworkInterface.

Parameter Name Required Type Description
vpcId Yes String Virtual private cloud ID of ENI (new ID is recommended), for example: vpc-7t9nf3pu.
subnetId Yes String Subnet of ENI (new ID is recommended), for example: subnet-0ap8nwca.
eniName Yes String ENI name; should be within 60 characters.
eniDescription No String ENI description; should be within 60 characters.
privateIpAddressSet.n No Array Specified private IP address array.
privateIpAddressSet.n.primary Yes Bool Indicate whether it is a primary IP; can only set one primary IP.
privateIpAddressSet.n.privateIpAddress Yes String Specified private IP address.
secondaryPrivateIpAddressCount No Int The number of private IP addresses for new requests.
sgIds.n No Array Specified Bound security group, for example: ['sg-1dd51d'].

3. Output Parameters

Parameter Name Type Description
code Int Error code. 0: succeeded, other values: failed
message String Error message
taskId Int Task ID. The operation result can be queried with taskId. For more information, refer to API for Querying Task Execution Result.

4. Error Code Table

The following error code list only provides the business logic error codes for this API. For additional common error codes, refer to VPC Error Codes.

Error Code Description
InvalidVpc.NotFound VPC does not exist. Please check the information you entered. You can query the VPC via the DescribeVpcEx API
InvalidSubnet.NotFound Subnet does not exist. Please check the information you entered. You can query the subnet via the DescribeSubnetEx API
InvalidNetworkInterfaceName Invalid ENI name. The ENI name should be within 60 characters.
NetworkInterfaceLimitExceeded Number of ENIs exceeds the upper limit. Please contact customer service for more resources. For more information on VPC resources restrictions, refer to VPC Service Limits

5. Example

Input


https://vpc.api.qcloud.com/v2/index.php?Action=CreateNetworkInterface
&<Common request parameters>
&vpcId=vpc-7t9nf3pu
&subnetId=subnet-0ap8nwca
&eniName=eni
&secondaryPrivateIpAddressCount=1
&sgIds.0=sg-1dd51d

Output

{
    "code": 0,
    "message": "",
    "codeDesc": "Success",
    "data":
        {
            "taskId": 16284
        }
}