All Products
Search
Document Center

Elastic Compute Service:DescribeNetworkInterfaces

Last Updated:Oct 09, 2024

Queries the details of one or more elastic network interfaces (ENIs). When you call this operation, you can specify parameters, such as ResourceGroupId, VSwitchId, and InstanceId, in the request.

Operation description

Usage notes

You can call the DescribeNetworkInterfaces operation for paged query by specifying the MaxResults or NextToken parameter. Take note of the following items:

  • During a paged query, when you call the DescribeNetworkInterfaces operation to retrieve the first page of results, set MaxResults to specify the maximum number of entries to return in the call. The return value of NextToken is a pagination token that can be used in the next call to retrieve a new page of results.
  • When you call the DescribeNetworkInterfaces operation to retrieve a new page of results, set NextToken to the NextToken value returned in the previous call and set MaxResults to specify the maximum number of entries to return in this call.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:DescribeNetworkInterfacesget
  • NetworkInterface
    acs:ecs:{#regionId}:{#accountId}:eni/{#eniId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
Tagarray<object>No

The tags to use for query.

objectNo
KeystringNo

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

TestKey
ValuestringNo

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

If a single tag is specified to query ENIs, up to 1,000 ENIs that have this tag can be returned. If multiple tags are specified to query ENIs, up to 1,000 ENIs that have all these tags can be returned. To query more than 1,000 resources that have specified tags, call the ListTagResources operation.

TestValue
ResourceGroupIdstringNo

The ID of the resource group to which the ENI belongs. If this parameter is specified to query resources, up to 1,000 resources that belong to the specified resource group can be returned.

Note Resources in the default resource group are displayed in the response regardless of how this parameter is set.
rg-bp67acfmxazb4p****
VSwitchIdstringNo

The ID of the vSwitch with which the ENI is associated.

vsw-bp16usj2p27htro3****
VpcIdstringNo

The ID of the virtual private cloud (VPC) to which the elastic network interface (ENI) belongs.

vsw-bp16usj2p27htro3****
PrimaryIpAddressstringNo

The primary private IPv4 address of the ENI.

192.168.**.**
SecurityGroupIdstringNo

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

  • To query the details of secondary ENIs based on the ID of a security group, specify this parameter.
  • To query the details of primary ENIs based on the ID of a security group, call the DescribeInstances operation and specify the SecurityGroupId parameter.
sg-bp144yr32sx6ndw****
NetworkInterfaceNamestringNo

The name of the ENI.

test-eni-name
TypestringNo

The type of the ENI. Valid values:

  • Primary
  • Secondary

This parameter is empty by default, which indicates that both primary and secondary ENIs are queried.

Secondary
InstanceIdstringNo

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

i-bp1e2l6djkndyuli****
ServiceManagedbooleanNo

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

true
StatusstringNo

The state of the ENI. Valid values:

  • Available: The ENI is available.
  • Attaching: The ENI is being attached to an instance.
  • InUse: The ENI is attached to an instance.
  • Detaching: The ENI is being detached from an instance.
  • Deleting: The ENI is being deleted.

This parameter is empty by default, which indicates that ENIs in all states are queried.

Available
PageNumberdeprecatedintegerNo

The page number.

Pages start from page 1.

Default value: 1.

Note This parameter will be removed in the future. We recommend that you use NextToken and MaxResults for a paged query.
1
PageSizedeprecatedintegerNo

The number of entries per page.

Valid values: 1 to 1000.

Default value: 10.

Note This parameter will be removed in the future. We recommend that you use NextToken and MaxResults for a paged query.
100
NextTokenstringNo

The query token. Set the value to the NextToken value returned in the last call to this operation.

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

AAAAAdDWBF2****
MaxResultsintegerNo

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

Default values:

  • If this parameter is not specified or if this parameter is set to a value less than 10, the default value is 10.
  • If this parameter is set to a value greater than 500, the default value is 500.
50
PrivateIpAddressarrayNo

An array that consists of the secondary private IPv4 addresses of the ENI. You can specify multiple secondary private IPv4 addresses. Valid values of N: 1 to 100.

stringNo

The secondary private IPv4 addresses of the ENI. You can specify multiple secondary private IPv4 addresses. Valid values of N: 1 to 100.

192.168.**.**
NetworkInterfaceIdarrayNo

An array that consists of the IDs of the ENIs. You specify multiple ENI IDs. Valid values of N: 1 to 100.

stringNo

The ID of the ENI N. You specify multiple ENI IDs. Valid values of N: 1 to 100.

eni-bp125p95hhdhn3ot****
Ipv6AddressarrayNo

An array that consists of the IPv6 address of the ENI. You can specify multiple IPv6 addresses. Valid values of N: 1 to 100.

stringNo

IPv6 address N of the ENI. You can specify multiple IPv6 addresses. Valid values of N: 1 to 100.

2408:4321:180:1701:94c7:bc38:3bfa:****

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

A pagination token. It can be used in the next request to retrieve a new page of results.

AAAAAdDWBF2****
PageSizeinteger

The number of entries returned per page.

Note This parameter will be removed in the future. We recommend that you use the NextToken and MaxResults parameters for a paged query.
1
PageNumberinteger

The page number of the returned page.

Note This parameter will be removed in the future. We recommend that you use the NextToken and MaxResults parameters for a paged query.
1
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
TotalCountinteger

The total number of ENIs.

Note If you specify the MaxResults and NextToken parameters to perform a paged query, the value of the TotalCount response parameter is invalid.
2
NetworkInterfaceSetsarray<object>

Details about the ENIs.

NetworkInterfaceSetobject
CreationTimestring

The time when the ENI was created.

2019-12-25T12:31:31Z
VpcIdstring

The ID of the VPC to which the ENI belongs.

vpc-bp1j7w3gc1cexjqd****
Typestring

The type of the ENI.

Secondary
Statusstring

The state of the ENI.

Available
NetworkInterfaceTrafficModestring

The communication mode of the ENI. Valid values:

  • Standard: The TCP communication mode is used.
  • HighPerformance: The Elastic RDMA Interface (ERI) is enabled and the remote direct memory access (RDMA) communication mode is used.
Note This parameter can have a value of HighPerformance only when the ENI is attached to a c7re RDMA-enhanced instance that resides in Beijing Zone K.
Standard
NetworkInterfaceNamestring

The name of the ENI.

my-eni-name
MacAddressstring

The MAC address of the ENI.

00:16:3e:12:**:**
QueuePairNumberinteger
Note This parameter is in invitational preview and is not publicly available.
0
NetworkInterfaceIdstring

The ID of the ENI.

eni-bp125p95hhdhn3ot****
ServiceIDlong

The ID of the distributor to which the ENI belongs.

12345678910
InstanceIdstring

The ID of the Elastic Compute Service (ECS) instance to which the ENI is attached.

Note If the ENI is managed by other Alibaba Cloud services, no instance ID is returned.
i-bp1e2l6djkndyuli****
OwnerIdstring

The ID of the account to which the ENI belongs.

123456****
ServiceManagedboolean

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

true
VSwitchIdstring

The ID of the vSwitch.

vsw-bp16usj2p27htro3****
Descriptionstring

The description of the ENI.

DescriptionTest
ResourceGroupIdstring

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

rg-2ze88m67qx5z****
ZoneIdstring

The zone ID of the ENI.

cn-hangzhou-e
PrivateIpAddressstring

The primary private IP address of the ENI.

172.17.**.**
QueueNumberinteger

The number of queues supported by the ENI.

  • If the ENI is a secondary ENI in the InUse state and the number of queues supported by the ENI has never been modified, the default number of queues per secondary ENI that the instance type supports is returned.
  • If the ENI is a secondary ENI and the number of queues supported by the ENI has been modified, the new number of queues is returned.
  • If the ENI is a secondary ENI in the Available state and the number of queues supported by the ENI has never been modified, an empty value is returned.
  • If the ENI is a primary ENI, the default number of queues per primary ENI that the instance type supports is returned.
8
PrivateIpSetsarray<object>

Details about the private IP addresses of the ENI.

PrivateIpSetobject
PrivateIpAddressstring

The private IP address of the ENI.

172.17.**.**
Primaryboolean

Indicates whether the private IP address is the primary private IP address. Valid values:

  • true: The IP address is the primary private IP address.
  • false: The IP address is a secondary private IP address.
true
AssociatedPublicIpobject

The elastic IP address (EIP) that is associated with the private IP address.

PublicIpAddressstring

The EIP.

116.62.**.**
AllocationIdstring
Note This parameter is in invitational preview and is not publicly available.
null
PrivateDnsNamestring
Note This parameter is in invitational preview and is not publicly available.
DnsTestName
Ipv6Setsarray<object>

The IPv6 addresses of the ENI.

Ipv6Setobject
Note This parameter is in invitational preview and is unavailable.
Ipv6Addressstring

The IPv6 address of the ENI.

2408:4321:180:1701:94c7:bc38:3bfa:****
Ipv4PrefixSetsarray<object>

The IPv4 prefixes of the ENI.

Ipv4PrefixSetobject
Note This parameter is in invitational preview and is unavailable.
Ipv4Prefixstring

The IPv4 prefix of the ENI.

hide
Ipv6PrefixSetsarray<object>

The IPv6 prefixes of the ENI.

Ipv6PrefixSetobject
Note This parameter is in invitational preview and is unavailable.
Ipv6Prefixstring

The IPv6 prefix of the ENI.

hide
Tagsarray<object>

The tags of the ENI.

Tagobject
TagValuestring

The tag value.

TestValue
TagKeystring

The tag key.

TestKey
SecurityGroupIdsarray

The security groups to which the ENI belongs.

SecurityGroupIdstring

The ID of the security group.

sg-bp18kz60mefsicfg****
AssociatedPublicIpobject

The EIPs that are associated with the secondary private IP addresses of the ENI.

PublicIpAddressstring

The EIP.

116.62.**.**
AllocationIdstring
Note This parameter is in invitational preview and is not publicly available.
null
Attachmentobject
Note This parameter is in invitational preview and is not publicly available.
DeviceIndexinteger
Note This parameter is in invitational preview and is not publicly available.
0
InstanceIdstring
Note This parameter is in invitational preview and is not publicly available.
null
TrunkNetworkInterfaceIdstring
Note This parameter is in invitational preview and is not publicly available.
null
NetworkCardIndexinteger

The index of the network card.

  • If the ENI is in the Available state or if no network card index was specified when the ENI was attached, this parameter is empty.
  • If the ENI is in the InUse state and a network card index was specified when the ENI was attached, the specified network card index is returned as the value of this parameter.
0
DeleteOnReleaseboolean

Indicates whether to retain the ENI when the associated instance is released. Valid values:

  • true
  • false
true

Examples

Sample success responses

JSONformat

{
  "NextToken": "AAAAAdDWBF2****",
  "PageSize": 1,
  "PageNumber": 1,
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "TotalCount": 2,
  "NetworkInterfaceSets": {
    "NetworkInterfaceSet": [
      {
        "CreationTime": "2019-12-25T12:31:31Z",
        "VpcId": "vpc-bp1j7w3gc1cexjqd****",
        "Type": "Secondary",
        "Status": "Available",
        "NetworkInterfaceTrafficMode": "Standard",
        "NetworkInterfaceName": "my-eni-name",
        "MacAddress": "00:16:3e:12:**:**",
        "QueuePairNumber": 0,
        "NetworkInterfaceId": "eni-bp125p95hhdhn3ot****",
        "ServiceID": 12345678910,
        "InstanceId": "i-bp1e2l6djkndyuli****",
        "OwnerId": "123456****",
        "ServiceManaged": true,
        "VSwitchId": "vsw-bp16usj2p27htro3****",
        "Description": "DescriptionTest",
        "ResourceGroupId": "rg-2ze88m67qx5z****",
        "ZoneId": "cn-hangzhou-e",
        "PrivateIpAddress": "172.17.**.**",
        "QueueNumber": 8,
        "PrivateIpSets": {
          "PrivateIpSet": [
            {
              "PrivateIpAddress": "172.17.**.**",
              "Primary": true,
              "AssociatedPublicIp": {
                "PublicIpAddress": "116.62.**.**",
                "AllocationId": "null"
              },
              "PrivateDnsName": "DnsTestName"
            }
          ]
        },
        "Ipv6Sets": {
          "Ipv6Set": [
            {
              "Ipv6Address": "2408:4321:180:1701:94c7:bc38:3bfa:****"
            }
          ]
        },
        "Ipv4PrefixSets": {
          "Ipv4PrefixSet": [
            {
              "Ipv4Prefix": "hide"
            }
          ]
        },
        "Ipv6PrefixSets": {
          "Ipv6PrefixSet": [
            {
              "Ipv6Prefix": "hide"
            }
          ]
        },
        "Tags": {
          "Tag": [
            {
              "TagValue": "TestValue",
              "TagKey": "TestKey"
            }
          ]
        },
        "SecurityGroupIds": {
          "SecurityGroupId": [
            "sg-bp18kz60mefsicfg****"
          ]
        },
        "AssociatedPublicIp": {
          "PublicIpAddress": "116.62.**.**",
          "AllocationId": "null"
        },
        "Attachment": {
          "DeviceIndex": 0,
          "InstanceId": "null",
          "TrunkNetworkInterfaceId": "null",
          "NetworkCardIndex": 0
        },
        "DeleteOnRelease": true,
        "SourceDestCheck": true
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400MissingParameter%sA parameter is not specified.
400UnsupportedParameter%sThe parameter is not supported.
400InvalidParameter%sThe specified parameter is invalid.
400InvalidInstanceID.Malformed%sThe specified InstanceId parameter is invalid.
400InvalidOperation.InvalidEcsState%s-
400InvalidOperation.InvalidEniState%s-
400InvalidOperation.DetachPrimaryEniNotAllowed%s-
400Forbidden.RegionId%sThe service is unavailable in the current region.
400InvalidRegionId.MalFormedThe specified parameter RegionId is not valid.The specified RegionId parameter is invalid.
403InvalidUserType.NotSupported%sYour account does not support this operation.
403Abs.InvalidAccount.NotFound%sYour Alibaba Cloud account does not exist or your AccessKey pair has expired.
403Forbidden.NotSupportRAM%sRAM users are not authorized to perform this operation.
403Forbidden.SubUser%sYou are not authorized to manage this resource. Contact the owner of the Alibaba Cloud account for authorization.
403MaxEniCountExceeded%sThe maximum number of ENIs that can be managed has been reached.
403EniPerInstanceLimitExceeded%sThe maximum number of ENIs that can be attached to the specified instance has been reached.
403InvalidOperation.AvailabilityZoneMismatch%sThe operation is invalid.
403InvalidOperation.VpcMismatch%sThe operation is invalid. Check whether the VPC in the operation corresponds to other parameters.
403SecurityGroupInstanceLimitExceed%s-
403InvalidSecurityGroupId.NotVpc%sThe specified SecurityGroupId parameter is invalid and the network type of the security group is not VPC.
403InvalidOperation.InvalidEniType%s-
403InvalidVpc.Empty%sNo vSwitches exist in the specified VPC. For more information, see the return value of the %s placeholder in the error message.
403InvalidOperation.InvalidEniPageNumber%s-
403InvalidVpc.Indeterminacy%s-
404InvalidEcsId.NotFound%sThe specified instance ID does not exist.
404InvalidEniId.NotFound%sThe specified ENI ID does not exist.
404InvalidVSwitchId.NotFound%sThe specified vSwitch does not exist.
404InvalidSecurityGroupId.NotFound%sThe specified security group ID does not exist.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-09-14The Error code has changed. The response structure of the API has changedView Change Details
2024-08-08The Error code has changed. The response structure of the API has changedView Change Details
2023-10-09The Error code has changed. The response structure of the API has changedView Change Details
2023-01-04The Error code has changed. The response structure of the API has changedView Change Details
2021-05-20The Error code has changed. The request parameters of the API has changedView Change Details