All Products
Search
Document Center

Elastic Compute Service:ModifyNetworkInterfaceAttribute

Last Updated:Oct 29, 2026

Modifies the attributes of an Elastic Network Interface (ENI), such as the number of queues, associated security groups, queue depth, traffic mode, and whether to retain the ENI when the instance is released.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:ModifyNetworkInterfaceAttribute

update

*NetworkInterface

acs:ecs:{#regionId}:{#accountId}:eni/{#eniId}

*SecurityGroup

acs:ecs:{#regionId}:{#accountId}:securitygroup/{#securitygroupId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the network interface controller (NIC). You can invoke the DescribeRegions operation to query the most recent region list.

cn-hangzhou

NetworkInterfaceName

string

No

The name of the Elastic Network Interface (ENI). The name must be 2 to 128 characters in length and must start with a letter or a Chinese character. It cannot start with http:// or https://. It supports characters in the Letter category of Unicode, such as English letters, Chinese characters, and digits. It can contain colons (:), underscores (_), periods (.), and hyphens (-).

Default value: empty.

eniTestName

NetworkInterfaceId

string

Yes

The ID of the network interface controller (NIC).

eni-bp67acfmxazb4p****

QueueNumber

integer

No

The number of queues for the ENI. Valid values: 1 to 2048.

  • You can modify the number of queues for an ENI that is in the Available state, or for an ENI that is attached (InUse) to an instance that is in the Stopped state.

  • The number of queues for the ENI cannot exceed the maximum number of queues per ENI allowed by the instance type. The total number of queues for all ENIs attached to the instance cannot exceed the total queue quota allowed by the instance type. You can call the DescribeInstanceTypes operation and query the MaximumQueueNumberPerEni and TotalEniQueueQuantity parameters to obtain the maximum number of queues per ENI and the total queue quota for the instance type.

8

Description

string

No

The description of the network interface controller (NIC). The description must be 2 to 255 characters in length and cannot start with http:// or https://.

Default value: empty.

testDescription

SecurityGroupId

array

No

The list of security group IDs. The secondary network interface controller (NIC) is added to the specified security groups and removed from its current security groups.

  • The valid values of N depend on the quota of security groups that each network interface controller (NIC) can join. For more information, see Limits.

  • The modification takes effect shortly, but there may be a slight delay.

string

No

The list of security group IDs.

  • The valid values of N depend on the quota of security groups that each network interface controller (NIC) can join. For more information, see Limits.

  • You can only modify the security groups of secondary ENIs.

  • After the security group settings are applied, the secondary network interface controller (NIC) is added to the specified security groups and removed from its current security groups.

  • The modification takes effect shortly, but there may be a slight delay.

sg-bp67acfmxazb4p****

DeleteOnRelease

boolean

No

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

  • true: The ENI is not retained.

  • false: The ENI is retained.

true

RxQueueSize

integer

No

The inbound queue depth of the network interface controller (NIC).

Note

This parameter is in invitational preview and is not available for public use. If you need to use it, submit a ticket to apply for whitelist access.

Take note of the following items:

  • This parameter applies only to seventh-generation and later ECS instance types.

  • This parameter currently applies only to Linux images.

  • A larger inbound queue depth can increase inbound throughput and reduce the packet loss rate, but it consumes more memory.

8192

TxQueueSize

integer

No

The outbound queue depth of the network interface controller (NIC).

Note

This parameter is in invitational preview and is not available for public use. If you need to use it, submit a ticket to apply for whitelist access.

Take note of the following items:

  • This parameter applies only to seventh-generation and later ECS instance types.

  • This parameter currently applies only to Linux images.

  • A larger outbound queue depth can increase outbound throughput and reduce the packet loss rate, but it consumes more memory.

8192

NetworkInterfaceTrafficConfig

object

No

The traffic parameters of the network interface controller (NIC).

NetworkInterfaceTrafficMode

string

No

The traffic pattern of the network interface controller (NIC). Valid values of the parameter:

  • Standard: uses the TCP traffic pattern.

  • HighPerformance: enables the Elastic RDMA Interface (ERI) and uses the RDMA traffic pattern.

When the Elastic Network Interface (ENI) is attached to an instance, take note of the following items:

  • The total number of RDMA network interface controllers (NICs) for the instance cannot exceed the RDMA network interface controller (NIC) quota allowed by the instance type. You can invoke the DescribeInstanceTypes operation and query the EriQuantity parameter to obtain the RDMA network interface controller (NIC) quota for the instance type.

Note

This parameter is in invitational preview and is not available for public use.

HighPerformance

QueueNumber

integer

No

The number of queues for the network interface controller (NIC). When the Elastic Network Interface (ENI) is attached to an instance, take note of the following items:

  • The number of queues cannot exceed the maximum number of queues per network interface controller (NIC) allowed by the instance type.

  • The total number of queues for all network interface controllers (NICs) attached to the instance cannot exceed the total queue quota allowed by the instance type. You can invoke the DescribeInstanceTypes operation and query the MaximumQueueNumberPerEni and TotalEniQueueQuantity parameters to obtain the maximum number of queues per network interface controller (NIC) and the total queue quota for the instance type.

Note

This parameter is in invitational preview and is not available for public use.

8

QueuePairNumber

integer

No

The number of queues for the RDMA network interface controller (NIC). When the Elastic Network Interface (ENI) is attached to an instance, take note of the following items:

  • The number of queues cannot exceed the maximum number of queues per RDMA network interface controller (NIC) allowed by the instance type. You can invoke the DescribeInstanceTypes operation and query the QueuePairNumber parameter to obtain the maximum number of queues per RDMA network interface controller (NIC) for the instance type.

Note

This parameter is in invitational preview and is not available for public use.

8

RxQueueSize

integer

No

The inbound queue depth of the network interface controller (NIC).

Note

This parameter is in invitational preview and is not available for public use. If you need to use it, submit a ticket to apply for whitelist access.

Take note of the following items:

  • This parameter applies only to seventh-generation and later ECS instance types.

  • This parameter currently applies only to Linux images.

  • A larger inbound queue depth can increase inbound throughput and reduce the packet loss rate, but it consumes more memory.

8192

TxQueueSize

integer

No

The outbound queue depth of the network interface controller (NIC).

Note

This parameter is in invitational preview and is not available for public use. If you need to use it, submit a ticket to apply for whitelist access.

Take note of the following items:

  • This parameter applies only to seventh-generation and later ECS instance types.

  • This parameter currently applies only to Linux images.

  • A larger outbound queue depth can increase outbound throughput and reduce the packet loss rate, but it consumes more memory.

8192

ConnectionTrackingConfiguration

object

No

The network connectivity tracking configuration information collection.

Before you use this parameter, read Connection timeout management carefully.

TcpEstablishedTimeout

integer

No

The timeout period for established TCP connections. Unit: seconds. Valid values: 30, 60, 80, 100, 200, 300, 500, 700, and 910.

Default value: 910.

910

TcpClosedAndTimeWaitTimeout

integer

No

The timeout period for closed and TIME_WAIT TCP connections. Unit: seconds. Valid values: integers from 3 to 15.

Default value: 3.

Note

If your ECS instance is used together with an NLB or CLB instance, the default timeout period for connections in the TIME_WAIT state is 15 seconds.

3

UdpTimeout

integer

No

The timeout period for UDP flows. Unit: seconds. Valid values: 10, 20, 30, 60, 80, and 100.

Default value: 30.

Note

If your ECS instance is used together with an NLB or CLB instance, the default value is 100 seconds.

30

EnhancedNetwork

object

No

This parameter is not available for public use.

EnableSriov

boolean

No

This parameter is not available for public use.

true

EnableRss

boolean

No

Note

This parameter is not available for public use.

false

VirtualFunctionTotalQueueNumber

integer

No

The total number of queues for virtual functions when SR-IOV is enabled.

4

VirtualFunctionQuantity

integer

No

The number of virtual functions when SR-IOV is enabled. Valid values: 1 to 256.

1

EnableExpress

boolean

No

Note

This parameter is not available for public use.

SourceDestCheck

boolean

No

Specifies whether to enable source/destination checking. We recommend that you enable this feature to improve network security. Valid values:

  • true: enabled.

  • false: disabled.

Default value: false.

Note

This feature is supported only in specific regions. Before you use it, read Source/destination checking carefully.

false

EnablePrimaryIPv6

boolean

No

Specifies whether to enable the primary IPv6 address for the network interface controller (NIC).

Response elements

Element

Type

Description

Example

object

The request ID.

RequestId

string

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

Examples

Success response

JSON format

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidOperation.NotSupportModifyQueueNumber %s
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 This operation is not allowed due to the current status of the cloud service.
400 InvalidOperation.InvalidEniState %s The current ENI status does not support this operation.
400 InvalidOperation.DetachPrimaryEniNotAllowed %s The primary ENI of an instance cannot be detached.
400 InvalidParams.EniId %s The specified EniId parameter is invalid.
400 Forbidden.RegionId %s The service is unavailable in the current region.
400 JoinedGroupLimitExceed %s The maximum number of security groups to which the specified resource can be added has been reached. For more information, see the return value of the %s placeholder in the error message.
400 InvalidEniQueueSize.RegionOrUserNotSupported The specified parameter RxQueueSize or TxQueueSize is not supported in this region, or this account is not in the whitelist of using eni QueueSize. You are not authorized to specify the length of NIC queues or cannot specify the length of NIC queues in the current region.
400 InvalidParameter.EniQueueSize The specified parameter TxQueueSize and RxQueueSize are not equal or exceed limit. The specified parameter TxQueueSize and RxQueueSize are not equal or exceed limit.
400 InvalidParameter.Conflict %s The specified parameter is invalid. Check whether parameter conflicts exist. %s is a variable. An error message is dynamically returned based on call conditions.
400 InvalidConnectionTrackingConfiguration.RegionOrUserNotSupported The specified parameter ConnectionTrackingConfiguration is not supported in this region, or this account is not in the whitelist of using network interface ConnectionTrackingConfiguration. The specified parameter ConnectionTrackingConfiguration is not supported in this region, or this account is not in the whitelist of using network interface ConnectionTrackingConfiguration.
400 InvalidParameter.InvalidQueuePairNumber The specified parameter QueuePairNumber exceeds limit. The number of queues on the specified ERI exceeds the limit.
400 InvalidParameter.EniConnectionTrackingConfiguration The specify network interface connection tracking configuration exceeds limit. The network connection configuration of the ENI is out of range.
400 InvalidOperation.MaxEniQueuePairNumberExceed The QueuePairNumber on the RDMA ENI exceeds the upper limit allowed for a single ENI. The number of RDMA queues on the ENI exceeds the maximum number of RDMA queues allowed per ENI.
400 InvalidOperation.HighPerformanceEniPerInstanceLimitExceeded The number of RDMA ENIs attached to the ECS instance exceeds the upper limit. The number of eRDMA interfaces (ERIs) on the ECS instance to which the ENI is attached exceeds the upper limit.
400 InvalidOperation.InstanceTypeNotSupportHighPerformance The ECS instance type where the ENI is located does not support the RDMA mode. The instance type of the ECS instance to which the ENI is attached does not support the RDMA communication mode.
400 InvalidTrafficMode.ModifyToStandardNotSupported The specified parameter NetworkInterfaceTrafficMode is not supported to modify to Standard. You cannot set the NetworkInterfaceTrafficMode parameter of the ENI to Standard.
400 InvalidOperation.EniTrafficModeNotSupportIPv6 The ENI using High Performance traffic mode does not support IPv6. ENIs that use the RDMA communication mode do not support IPv6.
400 InvalidOperation.EniQueuePairNumberOverflow The RDMA QueuePairNumber of the ECS instance associated with the specified ENI exceeds the limit. The number of RDMA queues on ENIs of the ECS instance to which the specified ENI is attached exceeds the upper limit.
400 InvalidParameter.QueuePairNumberMustEmpty When the traffic mode is set to Standard, the QueuePairNumber must be empty. When you create an ENI that uses the TCP communication mode, do not specify the number of RDMA queues for the ENI.
400 InvalidParameter.EniTrafficMode The ENI traffic mode is set incorrectly, it must be either Standard or HighPerformance. The NetworkInterfaceTrafficMode value is invalid. Valid values: Standard and HighPerformance.
400 InvalidOperation.InstanceTypeNotSupportRss The ECS instance type does not support Rss. The ECS instance type does not support Rss.
400 InvalidParameter.EniEnhancedNetwork The input parameter "EnhancedNetwork" is illegal, when EnableSriov is true, VirtualFunctionTotalQueueNumber must not be empty, and VirtualFunctionQuantity must be 1 to 256. When EnableSriov is empty or false, VirtualFunctionTotalQueueNumber and VirtualFunctionQuantity must be empty. The specified network enhancement function parameter is illegal. When the EnableSriov is set to true, the VirtualFunctionTotalQueueNumber must not be empty and the VirtualFunctionQuantity value range is 1-256; When the EnableSriov is empty or set to false, the VirtualFunctionTotalQueueNumber and VirtualFunctionQuantity must be empty
400 InvalidOperation.NotSupportModifyVFQueueNumberAndVFQuantity The ENI not support modify VirtualFunctionTotalQueueNumber and VirtualFunctionQuantity when EnableSriov is true. The ENI not support modify VirtualFunctionTotalQueueNumber and VirtualFunctionQuantity when EnableSriov is true.
400 InvalidOperation.TrunkAttachmentMustEmpty The Attachment of the current Trunk type Network Interface must be empty when modify EnableSriov to true. The Attachment of the current Trunk type Network Interface must be empty when modify EnableSriov to true.
400 Throttling Request was denied due to request throttling, try again later. Requests are too frequent due to resource or account dimensions, please try again later.
400 InvalidOperation.SourceDestCheckUnsupported Modifying sourceDestCheck attribute for network interface is not allowed in the %s region. The current region does not support modifying the ENI SourceDestCheck attributes.
400 InvalidOperation.EnablePrimaryIPv6 The specified ENI can not enable primary IPv6 or already has primary IPv6. The specified ENI can not enable primary IPv6 or already has primary IPv6.
500 InternalError The request processing has failed due to some unknown error, exception or failure. An internal error has occurred. Try again later.
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 The maximum number of instances in the security group has been reached.
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 This operation is not allowed for the current network interface type.
403 InvalidOperation.EniServiceManaged %s The operation is invalid.
403 InvalidOperation.MultiGroupType The specified instance can't join different types of security group. The specified instance cannot be added to security groups of different types.
403 InvalidOperation.EniCountExceeded The maximum number of eni in a enterprise level security group is exceeded. The number of NICs in the enterprise security group exceeds the limit.
403 InvalidParams.NetworkInterfaceName %s
403 InvalidOperation.ModifyPrimaryEniQueueNumber Primary NetworkInterface is not allowed to modify queue number.
403 InvalidOperation.InvalidEniState Available status or ECS instance attached is Stopped is allowed to modify network interface queue number. The current ENI status does not support this operation.
403 InvalidOperation.ResourceManagedByCloudProduct %s You cannot modify security groups managed by cloud services.
403 InvalidParameter.InvalidEniQueueNumber %s The number of network interface controller (NIC) queues is invalid. For more information, see the actual value of the %s placeholder in the error message.
403 InvalidOperation.MaxEniQueueNumberExceeded %s The number of network interface controller (NIC) queues exceeds the upper limit. For more information, see the actual value of the %s placeholder in the error message.
403 InvalidOperation.ExceedInstanceTypeQueueNumber %s The maximum number of queues for all ENIs on an instance has been exceeded. For more information, see the return value of the %s placeholder in the error message.
403 AclLimitExceed %s The number of ACL rules for an ENI or instance exceeds the upper limit.
403 InvalidOperation.EniTypeUnsupported The specified eni type does not supported. The specified business type is not supported.
403 InvalidVSwitch.Ipv6NotEnabled The VSwitch of ENI does not support IPv6 feature.
404 InvalidEcsId.NotFound %s The specified instance ID does not exist.
404 InvalidEniId.NotFound %s
404 InvalidVSwitchId.NotFound %s The specified vSwitch does not exist.
404 InvalidSecurityGroupId.NotFound %s The specified security group ID does not exist.
404 InvalidOperation.PrimaryEniOnlySupportModifyNameAndDesc Primary NetworkInterface is only allowed to modify name and description. Primary ENIs can only have their names and descriptions modified.
404 InvalidParameter.SecurityGroupIdRepeated The specified security group ids has repeated. Duplicate security group IDs are specified. Check whether the specified SecurityGroupIds.N parameter is valid.
409 OperationConflict Request was denied due to conflict with a previous request,please try again later. A request conflict occurred. Wait a moment and try again, or submit a ticket.
409 TokenProcessing The previous token request is still processing. Please try again later.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.