You can call this operation to view the list of Elastic Network Interfaces (ENIs).

Description

DescribeNetworkInterfaces provides two ways to check responses:

  • Method 1: Use NextToken to configure the query token. The value of this parameter is the value of NextToken returned by the last call of the DescribeNetworkInterfaces operation. Then use MaxResults to configure the maximum number of entries to return on each page.
  • Method 2: Use PageSize to configure the number of entries to return on each page and use PageNumber to configure the number of the page to return.

    You can only use one of the preceding methods. If many entries are contained in the ENI list, we recommend that you use Method 1. If NextToken is set, the PageSize and the PageNumber parameters will not take effect and the TotalCount response parameter will be invalid.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String No DescribeNetworkInterfaces

The operation that you want to perform. Set the value to DescribeNetworkInterfaces.

RegionId String Yes cn-hangzhou

The ID of the region. You can call the DescribeRegions operation to query the most recent region list.

Tag.N.Key String No test

The key of tag N that is bound to the ENI. Valid values of N: 1 to 20.

Tag.N.Value String No api-test

The value of tag N that is bound to the ENI. Valid values of N: 1 to 20.

ResourceGroupId String No rg-bp67acfmxazb4ph***

The ID of the resource group to which the ENI belongs.

VSwitchId String No vsw-bp16usj2p27htro3*****

The ID of the VSwitch to which the ENI belongs.

VpcId String No vsw-bp16usj2p27htro3*****

The ID of the VPC to which the ENI belongs.

PrimaryIpAddress String No 192.168.1.2

The primary private IP address of the ENI.

PrivateIpAddress.N RepeatList No 192.168.1.1

The secondary private IP address N of the ENI. Valid values of N: 1 to 100.

SecurityGroupId String No sg-bp144yr32sx6ndw*****

The ID of the security group to which the ENI belongs.

NetworkInterfaceName String No my-eni-name

The name of the ENI.

Type String No Secondary

The type of the ENI. Valid values:

  • Primary
  • Secondary
InstanceId String No i-bp1e2l6djkndyulib***

The ID of the instance to which the ENI is attached.

NetworkInterfaceId.N RepeatList No eni-bp125p95hhdhn3otz***

The ID of ENI N. Valid values of N: 1 to 100.

ServiceManaged Boolean No true

Specifies whether the user is an Alibaba Cloud service or a distributor.

PageNumber Integer No 1

The number of the page to return.

Pages start from page 1.

Default value: 1.

PageSize Integer No 100

The number of entries to return on each page.

Maximum value: 100.

Default value: 10.

For more information about how to check responses of this operation, see the preceding "Description" section.

NextToken String No AAAAAdDWBF2****w==

The query token. Set the value to the NextToken parameter value returned by the last API call.

For more information about how to check responses of this operation, see the preceding "Description" section.

MaxResults Integer No 50

The maximum number of entries to return on each page. Valid values: 1 to 500.

Default value: 10.

Response parameters

Parameter Type Example Description
NetworkInterfaceSets Array

The set of ENIs.

NetworkInterfaceSet
AssociatedPublicIp Struct

The public IP address associated with the secondary private IP address of the ENI.

AllocationId String eip-2ze88m67qx5z*****

The ID of the allocated Elastic IP address (EIP).

PublicIpAddress String 116.62.129.***

The public IP address.

CreationTime String 2017-11-24T06:14:22Z

The time when the ENI was created.

Description String test

The description of the ENI.

InstanceId String i-bp1e2l6djkndyulib***

The ID of the instance to which the ENI was attached.

Note If you query ENIs managed and controlled by other Alibaba Cloud services, the instance ID will not be returned.
Ipv6Sets Array

The set of IPv6 addresses assigned to the ENI.

Ipv6Set
Ipv6Address String 2001:db8:1234:1a00::***

The IPv6 address assigned to the ENI.

MacAddress String 2001:db8:1234:1a00::***

The MAC address assigned to the ENI.

NetworkInterfaceId String eni-bp125p95hhdhn3otz***

The ID of the ENI.

NetworkInterfaceName String my-eni-name

The name of the ENI.

OwnerId String 123456789

The ID of the account that owns the ENI.

PrivateIpAddress String 172.17.**. ***

The private IP address of the ENI.

PrivateIpSets Array

The set of private IP addresses of the ENI.

PrivateIpSet
AssociatedPublicIp Struct

The public IP address associated with the ENI.

AllocationId String eip-2ze88m67qx5z*****

The ID of the allocated EIP.

PublicIpAddress String 116.62.**.250

The public IP address of the instance.

Primary Boolean true

Indicates whether the IP address is a primary IP address.

PrivateIpAddress String 172.17.**. ***

The private IP address of the instance.

QueueNumber Integer 2

The queue number of the ENI.

ResourceGroupId String rg-2ze88m67qx5z*****

The ID of the resource group.

SecurityGroupIds List sg-bp18kz60mefsicfgo***

The IDs of security groups.

ServiceID Long 123456789

The ID of the distributor to which the ENI belongs.

ServiceManaged Boolean true

Indicates whether the user is an Alibaba Cloud service or a distributor.

Status String Available

The status of the ENI.

Tags Array

The tags of the ENI.

Tag
TagKey String test

The tag key of the ENI.

TagValue String api

The tag value of the ENI.

Type String Secondary

The type of the ENI.

VSwitchId String vsw-bp16usj2p27htro3*****

The ID of the VSwitch to which the ENI belongs.

VpcId String vpc-bp1j7w3gc1cexjqd*****

The ID of the VPC to which the ENI belongs.

ZoneId String cn-hangzhou-e

The ID of the zone.

NextToken String AAAAAdDWBF2****w==

The value of the query token returned in this call.

PageNumber Integer 1

The page number of the returned page.

PageSize Integer 1

The number of entries returned per page.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

TotalCount Integer 70

The total number of ENIs.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DescribeNetworkInterfaces
&RegionId=cn-hangzhou &PrivateIpAddress.1=192.168.1.1
&PrivateIpAddress.2=192.168.1.2
&NextToken=AAAAAdDWBF2****w==
&<Common request parameters>

Sample success responses

XML format

<DescribeNetworkInterfacesResponse>
      <PageNumber>1</PageNumber>
      <NextToken>AAAAAdDWBF2w6Olxc+cMPjUtUMoOHldehKPIfYtMyAi+***w+IDifXafILjY/QdPWM1nUw==</NextToken>
      <TotalCount>0</TotalCount>
      <PageSize>10</PageSize>
      <RequestId>F5266102-405B-4EEC-AAD8-ADF227463EA9</RequestId>
      <NetworkInterfaceSets>
            <NetworkInterfaceSet>
                  <Type>Primary</Type>
                  <ResourceGroupId></ResourceGroupId>
                  <InstanceId>i-bp188rg4xz5qev******</InstanceId>
                  <PrivateIpSets>
                        <PrivateIpSet>
                              <PrivateIpAddress>172.16. ***.99</PrivateIpAddress>
                              <Primary>true</Primary>
                              <AssociatedPublicIp></AssociatedPublicIp>
                        </PrivateIpSet>
                  </PrivateIpSets>
                  <ZoneId>cn-hangzhou-g</ZoneId>
                  <VSwitchId>vsw-bp1s5fnvk4gn2tw******</VSwitchId>
                  <VpcId>vpc-bp1opxu1zkhn00g******</VpcId>
                  <AssociatedPublicIp></AssociatedPublicIp>
                  <NetworkInterfaceId>eni-bp14664y88uf9t******</NetworkInterfaceId>
                  <CreationTime>2018-11-09T13:56:24Z</CreationTime>
                  <Status>InUse</Status>
                  <MacAddress>00:16:3e:15:40:5d</MacAddress>
                  <SecurityGroupIds>
                        <SecurityGroupId>sg-bp10zcgmybh0qc******</SecurityGroupId>
                  </SecurityGroupIds>
                  <PrivateIpAddress>172.16. ***.99</PrivateIpAddress>
            </NetworkInterfaceSet>
      </NetworkInterfaceSets>
</DescribeNetworkInterfacesResponse>

JSON format

{
    "PageNumber": 1,
    "NextToken": "AAAAAdDWBF2w6Olxc+cMPjUtUMoOHldehKPIfYtMyAi+***w+IDifXafILjY/QdPWM1nUw==",
    "TotalCount": 0,
    "PageSize": 10,
    "RequestId": "F5266102-405B-4EEC-AAD8-ADF227463EA9",
    "NetworkInterfaceSets": {
        "NetworkInterfaceSet": [
            {
                "Type": "Primary",
                "ResourceGroupId": "",
                "InstanceId": "i-bp188rg4xz5qev******",
                "PrivateIpSets": {
                    "PrivateIpSet": [
                        {
                            "PrivateIpAddress": "172.16. ***.99",
                            "Primary": true,
                            "AssociatedPublicIp": {}
                        }
                    ]
                },
                "ZoneId": "cn-hangzhou-g",
                "VSwitchId": "vsw-bp1s5fnvk4gn2tw******",
                "VpcId": "vpc-bp1opxu1zkhn00g******",
                "AssociatedPublicIp": {},
                "NetworkInterfaceId": "eni-bp14664y88uf9t******",
                "CreationTime": "2018-11-09T13:56:24Z",
                "Status": "InUse",
                "MacAddress": "00:16:3e:15:40:5d",
                "SecurityGroupIds": {
                    "SecurityGroupId": [
                        "sg-bp10zcgmybh0qc******"
                    ]
                },
                "PrivateIpAddress": "172.16. ***.99"
            }
        ]
    }
}

Error codes

HTTP status code Error code Error message Description
403 InvalidUserType.NotSupported %s The error message returned because the current account does not support this operation.
403 Abs.InvalidAccount.NotFound %s The error message returned because your Alibaba Cloud account does not exist or your AccessKey pair has expired.
400 MissingParameter %s The error message returned because a required parameter is not specified.
403 Forbidden.NotSupportRAM %s The error message returned because RAM users are not authorized to perform this operation.
400 UnsupportedParameter %s The error message returned because the specified parameter is not supported.
403 Forbidden.SubUser %s The error message returned because you are not authorized to perform operations on this resource. Contact the owner of the Alibaba Cloud account for authorization.
400 InvalidParameter %s The error message returned because the specified parameter is invalid.
400 InvalidInstanceID.Malformed %s The error message returned because the InstanceId parameter value is invalid.
400 InvalidOperation.InvalidEcsState %s The error message returned because the operation is not supported while the instance is in the current state.
400 InvalidOperation.InvalidEniState %s The error message returned because the operation is not supported while the ENI is in the current state.
400 InvalidOperation.DetachPrimaryEniNotAllowed %s The error message returned because the primary ENI is detached from the instance.
404 InvalidEcsId.NotFound %s The error message returned because the specified instance ID does not exist.
404 InvalidEniId.NotFound %s The error message returned because the specified ENI ID does not exist.
404 InvalidVSwitchId.NotFound %s The error message returned because the specified VSwitch ID does not exist.
404 InvalidSecurityGroupId.NotFound %s The error message returned because the specified security group ID does not exist.
403 MaxEniCountExceeded %s The error message returned because the maximum number of ENIs that can be managed has been reached.
403 EniPerInstanceLimitExceeded %s The error message returned because the maximum number of ENIs that can be attached to an instance has been reached.
403 InvalidOperation.AvailabilityZoneMismatch %s The error message returned because this operation is invalid.
403 InvalidOperation.VpcMismatch %s The error message returned because this operation is invalid. Check whether the VPC in the operation corresponds to other parameters.
403 SecurityGroupInstanceLimitExceed %s The error message returned because the maximum number of instances in the specified security group has been reached.
403 InvalidSecurityGroupId.NotVpc %s The error message returned because the SecurityGroupId parameter value is invalid and the network type of the security group is not VPC.
403 InvalidOperation.InvalidEniType %s The error message returned because the current ENI type does not support this operation.
400 Forbidden.RegionId %s The error message returned because the service is unavailable in the current region.

For a list of error codes, visit the API Error Center.