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 ofNextToken
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 theNextToken
value returned in the previous call and setMaxResults
to specify the maximum number of entries to return in this call.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ecs:DescribeNetworkInterfaces | get |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the ENI. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
Tag | array<object> | No | The tags to use for query. | |
object | No | |||
Key | string | No | The key of tag N of the ENI. Valid values of N: 1 to 20. | TestKey |
Value | string | No | 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 |
ResourceGroupId | string | No | 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**** |
VSwitchId | string | No | The ID of the vSwitch with which the ENI is associated. | vsw-bp16usj2p27htro3**** |
VpcId | string | No | The ID of the virtual private cloud (VPC) to which the elastic network interface (ENI) belongs. | vsw-bp16usj2p27htro3**** |
PrimaryIpAddress | string | No | The primary private IPv4 address of the ENI. | 192.168.**.** |
SecurityGroupId | string | No | The ID of the security group to which the secondary ENI belongs.
| sg-bp144yr32sx6ndw**** |
NetworkInterfaceName | string | No | The name of the ENI. | test-eni-name |
Type | string | No | The type of the ENI. Valid values:
This parameter is empty by default, which indicates that both primary and secondary ENIs are queried. | Secondary |
InstanceId | string | No | The ID of the instance to which the ENI is attached. | i-bp1e2l6djkndyuli**** |
ServiceManaged | boolean | No | Specifies whether the user of the ENI is an Alibaba Cloud service or a distributor. | true |
Status | string | No | The state of the ENI. Valid values:
This parameter is empty by default, which indicates that ENIs in all states are queried. | Available |
PageNumberdeprecated | integer | No | 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 |
PageSizedeprecated | integer | No | 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 |
NextToken | string | No | The query token. Set the value to the For more information about how to check the responses returned by this operation, see the preceding "Description" section. | AAAAAdDWBF2**** |
MaxResults | integer | No | The maximum number of entries to return on each page. Valid values: 10 to 500. Default values:
| 50 |
PrivateIpAddress | array | No | 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. | |
string | No | 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.**.** | |
NetworkInterfaceId | array | No | An array that consists of the IDs of the ENIs. You specify multiple ENI IDs. Valid values of N: 1 to 100. | |
string | No | The ID of the ENI N. You specify multiple ENI IDs. Valid values of N: 1 to 100. | eni-bp125p95hhdhn3ot**** | |
Ipv6Address | array | No | An array that consists of the IPv6 address of the ENI. You can specify multiple IPv6 addresses. Valid values of N: 1 to 100. | |
string | No | 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
Examples
Sample success responses
JSON
format
{
"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 code | Error code | Error message | Description |
---|---|---|---|
400 | MissingParameter | %s | A parameter is not specified. |
400 | UnsupportedParameter | %s | The parameter is not supported. |
400 | InvalidParameter | %s | The specified parameter is invalid. |
400 | InvalidInstanceID.Malformed | %s | The specified InstanceId parameter is invalid. |
400 | InvalidOperation.InvalidEcsState | %s | - |
400 | InvalidOperation.InvalidEniState | %s | - |
400 | InvalidOperation.DetachPrimaryEniNotAllowed | %s | - |
400 | Forbidden.RegionId | %s | The service is unavailable in the current region. |
400 | InvalidRegionId.MalFormed | The specified parameter RegionId is not valid. | The specified RegionId parameter is invalid. |
403 | InvalidUserType.NotSupported | %s | Your account does not support this operation. |
403 | Abs.InvalidAccount.NotFound | %s | Your Alibaba Cloud account does not exist or your AccessKey pair has expired. |
403 | Forbidden.NotSupportRAM | %s | RAM users are not authorized to perform this operation. |
403 | Forbidden.SubUser | %s | You are not authorized to manage this resource. Contact the owner of the Alibaba Cloud account for authorization. |
403 | MaxEniCountExceeded | %s | The maximum number of ENIs that can be managed has been reached. |
403 | EniPerInstanceLimitExceeded | %s | The maximum number of ENIs that can be attached to the specified instance has been reached. |
403 | InvalidOperation.AvailabilityZoneMismatch | %s | The operation is invalid. |
403 | InvalidOperation.VpcMismatch | %s | The operation is invalid. Check whether the VPC in the operation corresponds to other parameters. |
403 | SecurityGroupInstanceLimitExceed | %s | - |
403 | InvalidSecurityGroupId.NotVpc | %s | The specified SecurityGroupId parameter is invalid and the network type of the security group is not VPC. |
403 | InvalidOperation.InvalidEniType | %s | - |
403 | InvalidVpc.Empty | %s | No vSwitches exist in the specified VPC. For more information, see the return value of the %s placeholder in the error message. |
403 | InvalidOperation.InvalidEniPageNumber | %s | - |
403 | InvalidVpc.Indeterminacy | %s | - |
404 | InvalidEcsId.NotFound | %s | The specified instance ID does not exist. |
404 | InvalidEniId.NotFound | %s | The specified ENI ID does not exist. |
404 | InvalidVSwitchId.NotFound | %s | The specified vSwitch does not exist. |
404 | InvalidSecurityGroupId.NotFound | %s | The specified security group ID does not exist. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-09-14 | The Error code has changed. The response structure of the API has changed | View Change Details |
2024-08-08 | The Error code has changed. The response structure of the API has changed | View Change Details |
2023-10-09 | The Error code has changed. The response structure of the API has changed | View Change Details |
2023-01-04 | The Error code has changed. The response structure of the API has changed | View Change Details |
2021-05-20 | The Error code has changed. The request parameters of the API has changed | View Change Details |