All Products
Search
Document Center

Elastic Compute Service:ModifyNetworkInterfaceAttribute

Last Updated:Aug 27, 2026

Modifies the attributes of an Elastic Network Interface (ENI), such as the queue number, associated security groups, queue depth, communication mode, and whether to retain the ENI when the associated 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 DescribeRegions to query the most recent region list.

cn-hangzhou

NetworkInterfaceName

string

No

The name of the network interface controller (NIC). 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://. The name can contain characters under the categorization of letter in Unicode, including English letters, Chinese characters, and digits. The name can also contain colons (:), underscores (_), periods (.), or 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 queue number of an ENI that is in the Available state, or an ENI that is in the InUse state but attached to an instance in the Stopped state.

  • The queue number cannot exceed the maximum number of queues per ENI allowed by the instance type. The total number of queues across all ENIs of an instance cannot exceed the total queue quota allowed by the instance type. You can call DescribeInstanceTypes to query the MaximumQueueNumberPerEni and TotalEniQueueQuantity fields 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) joins the specified security groups and is removed from the existing security groups.

  • Valid values of N depend on the maximum number of security groups to which a network interface controller (NIC) can belong. For more information, see Limits.

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

string

No

The list of security group IDs.

  • Valid values of N depend on the maximum number of security groups to which a network interface controller (NIC) can belong. For more information, see Limits.

  • You can modify security groups only for secondary ENIs.

  • After the security groups are configured, the secondary ENI joins the specified security groups and is removed from the existing security groups.

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

sg-bp67acfmxazb4p****

DeleteOnRelease

boolean

No

Specifies whether to retain the ENI when the associated 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 publicly available. To use this parameter, submit a ticket to request access.

Take note of the following items:

  • This parameter applies only to instances of the seventh generation or later.

  • This parameter currently applies only to Linux images.

  • A larger inbound queue depth can improve inbound throughput and reduce packet loss, but 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 publicly available. To use this parameter, submit a ticket to request access.

Take note of the following items:

  • This parameter applies only to instances of the seventh generation or later.

  • This parameter currently applies only to Linux images.

  • A larger outbound queue depth can improve outbound throughput and reduce packet loss, but consumes more memory.

8192

NetworkInterfaceTrafficConfig

object

No

The communication parameter of the network interface controller (NIC).

NetworkInterfaceTrafficMode

string

No

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

  • Standard: uses the TCP communication pattern.

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

When the network interface controller (NIC) is in the attached state, take note of the following items:

  • The total number of RDMA network interface controllers (NICs) of an instance cannot exceed the RDMA network interface controller (NIC) quota allowed by the instance type. You can call DescribeInstanceTypes to query the EriQuantity field for the RDMA network interface controller (NIC) quota.

Note

This parameter is in invitational preview and is not publicly available.

HighPerformance

QueueNumber

integer

No

The number of queues for the network interface controller (NIC). When the network interface controller (NIC) is in the attached state, take note of the following items:

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

  • The total number of queues across all network interface controllers (NICs) of an instance cannot exceed the total queue quota allowed by the instance type. You can call DescribeInstanceTypes to query the MaximumQueueNumberPerEni and TotalEniQueueQuantity fields.

Note

This parameter is in invitational preview and is not publicly available.

8

QueuePairNumber

integer

No

The number of RDMA queues for the network interface controller (NIC). When the network interface controller (NIC) is in the attached state, take note of the following items:

  • The value cannot exceed the maximum number of queues per RDMA network interface controller (NIC) allowed by the instance type. You can call DescribeInstanceTypes to query the QueuePairNumber field for the maximum number of queues per RDMA network interface controller (NIC).

Note

This parameter is in invitational preview and is not publicly available.

8

RxQueueSize

integer

No

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

Note

This parameter is in invitational preview and is not publicly available. To use this parameter, submit a ticket to request access.

Take note of the following items:

  • This parameter applies only to instances of the seventh generation or later.

  • This parameter currently applies only to Linux images.

  • A larger inbound queue depth can improve inbound throughput and reduce packet loss, but 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 publicly available. To use this parameter, submit a ticket to request access.

Take note of the following items:

  • This parameter applies only to instances of the seventh generation or later.

  • This parameter currently applies only to Linux images.

  • A larger outbound queue depth can improve outbound throughput and reduce packet loss, but consumes more memory.

8192

ConnectionTrackingConfiguration

object

No

The network connectivity tracking configuration.

Before you use this parameter, read Connection timeout management.

TcpEstablishedTimeout

integer

No

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

Default value: 910.

910

TcpClosedAndTimeWaitTimeout

integer

No

The timeout period for TCP connections in the TIME_WAIT and CLOSED states. Unit: seconds. Valid values: integers from 3 to 15.

Default value: 3.

Note

If your ECS instance is used with NLB or CLB, 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, 100].

Default value: 30.

Note

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

30

EnhancedNetwork

object

No

This parameter is not publicly available.

EnableSriov

boolean

No

This parameter is not publicly available.

true

EnableRss

boolean

No

Note

This parameter is not publicly available.

false

VirtualFunctionTotalQueueNumber

integer

No

VirtualFunctionQuantity

integer

No

EnableExpress

boolean

No

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

Only specific regions support this feature. Before using this feature, read Source/destination checking.

false

EnablePrimaryIPv6

boolean

No

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 The current status of the instance does not support this operation.
400 InvalidOperation.InvalidEniState %s The current status of the ENI does not allow modifying the ENI attributes.
400 InvalidOperation.DetachPrimaryEniNotAllowed %s Detaching the primary ENI from an instance is not allowed.
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 number of instances in the security group has reached the maximum limit.
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 The current type of the Elastic Network Interface (ENI) does not support this operation.
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 join 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 status of the ENI does not allow modifying the ENI attributes.
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 incorrect. For more information, refer to the actual return result of the %s placeholder in the error message.
403 InvalidOperation.MaxEniQueueNumberExceeded %s The number of Elastic Network Interface (ENI) queues exceeds the upper limit. For more information, see the actual return result 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. The requested resource conflicts with a previous request.
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.