Creates an elastic network interface (ENI).
Operation description
Usage notes
Take note of the following items:
- This operation is a synchronous operation. After an ENI is created, it immediately enters the Available (
Available
) state and can be attached to an Elastic Compute Service (ECS) instance. - If NetworkInterfaceId is empty in the response, no ENI is created. Call the operation again to create an ENI.
- An ENI can be attached only to a single instance that resides in a virtual private cloud (VPC).
- When an ENI is detached from an instance and attached to another instance, the attributes of the ENI remain unchanged and network traffic is redirected to the new instance.
- If you want to assign IPv6 addresses when you create an ENI, make sure that IPv6 is enabled for the vSwitch with which you want to associate the ENI. For more information, see What is an IPv6 gateway?
- A quota is imposed on the number of ENIs that can be created per Alibaba Cloud region per account. You can view the quota on the ECS console. For more information, see View and increase resource quotas.
**For information about examples on how to call the CreateNetworkInterface operation, see **Create an ENI.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
Tag | object [] | No | The tags to add to the ENI. | |
Key | string | No | The key of tag N to add to the ENI. Valid values of N: 1 to 20. The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain | TestKey |
Value | string | No | The value of tag N to add to the ENI. Valid values of N: 1 to 20. The tag value can be an empty string. The tag value can be up to 128 characters in length. It cannot start with acs: or contain | TestValue |
ResourceGroupId | string | No | The ID of the resource group to which you want to assign the ENI. You can call the ListResourceGroups operation to query the most recent resource group list. | rg-bp67acfmxazb4ph**** |
VSwitchId | string | Yes | The ID of the vSwitch with which to associate the ENI. Private IP addresses are assigned to the ENI from within the CIDR block of the vSwitch. | vsw-bp1s5fnvk4gn2tws03**** |
PrimaryIpAddress | string | No | The primary private IP address of the ENI. The specified IP address must be an idle IP address within the CIDR block of the vSwitch with which to associate the ENI. If this parameter is not specified, an idle IP address is assigned from within the vSwitch CIDR block at random. | 172.17.**.** |
SecurityGroupId | string | No | The ID of the security group to which to assign the ENI. The security group and the ENI must belong to the same VPC. Note
You must specify SecurityGroupId or SecurityGroupIds.N but not both.
| sg-bp1fg655nh68xyz9i**** |
NetworkInterfaceName | string | No | The name of the ENI. The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with This parameter is empty by default. | testNetworkInterfaceName |
Description | string | No | The description of the ENI. The description must be 2 to 256 characters in length and cannot start with This parameter is empty by default. | testDescription |
Visible | boolean | No | Note
This parameter is no longer used.
| null |
InstanceType | string | No | Note
This parameter is no longer used.
| null |
BusinessType | string | No | Note
This parameter is no longer used.
| null |
SecondaryPrivateIpAddressCount | integer | No | The number of private IP addresses to be automatically created by ECS. Valid values: 1 to 49. | 1 |
QueueNumber | integer | No | The number of queues supported by the ENI. Valid values: 1 to 2048. When you attach the ENI to an instance, make sure that the value of this parameter is less than the maximum number of queues per ENI that is allowed for the instance type. To view the maximum number of queues per ENI allowed for an instance type, you can call the DescribeInstanceTypes operation and then check the return value of This parameter is left empty by default. If you do not specify this parameter, the default number of queues per ENI for the instance type of an instance is used when you attach the ENI to the instance. To view the default number of queues per ENI for an instance type, you can call the DescribeInstanceTypes operation and then check the return value of | 1 |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. | 123e4567-e89b-12d3-a456-426655440000 |
NetworkInterfaceTrafficMode | string | No | The communication model of the ENI. Valid values:
Note
This parameter can have a value of HighPerformance only when the ENI is attached to a c7re RDMA-enhanced instance. The number of ERIs on a c7re instance cannot exceed the maximum number of ERIs that the instance type supports. The c7re instance family is in invitational preview in Beijing Zone K. For more information, see Overview of instance families.
Default value: Standard. | Standard |
QueuePairNumber | integer | No | Note
This parameter is in invitational preview and is not publicly available.
| 22 |
SecurityGroupIds | array | No | The ID of security group N to which to assign the ENI. The security group and the ENI must belong to the same VPC. The valid values of N are determined based on the maximum number of security groups to which an ENI can be assigned. For more information, see Limits . ** You must specify SecurityGroupId or SecurityGroupIds.N but not both.```` | |
string | No | The ID of security group N to which to assign the ENI. The security group and the ENI must belong to the same VPC. The valid values of N are determined based on the maximum number of security groups to which an ENI can be assigned. For more information, see Limits . ** You must specify SecurityGroupId or SecurityGroupIds.N but not both.```` | sg-bp1fg655nh68xyz9i**** | |
PrivateIpAddress | array | No | Secondary private IP address N to assign to the ENI. This IP address must be an idle IP address within the CIDR block of the vSwitch with which to associate the ENI. Valid values of N: 0 to 10. Note
To assign secondary private IP addresses to the ENI, you can specify the PrivateIpAddress.N or SecondaryPrivateIpAddressCount parameter, but not both.
| |
string | No | Secondary private IP address N to assign to the ENI. This IP address must be an idle IP address within the CIDR block of the vSwitch with which to associate the ENI. Valid values of N: 0 to 10. Note
To assign secondary private IP addresses to the ENI, you can specify the PrivateIpAddress.N or SecondaryPrivateIpAddressCount parameter, but not both.
| 172.17.**.** | |
Ipv6Address | array | No | IPv6 address N to assign to the ENI. Valid values of N: 1 to 10. Example: Ipv6Address.1=2001:db8:1234:1a00::**** Note
To assign IPv6 addresses to the ENI, you must specify the Ipv6Addresses.N or Ipv6AddressCount parameter, but not both.
| |
string | No | IPv6 address N to assign to the ENI. Valid values of N: 1 to 10. Example: Ipv6Address.1=2001:db8:1234:1a00::**** Note
To assign IPv6 addresses to the ENI, you must specify the Ipv6Addresses.N or Ipv6AddressCount parameter, but not both.
| 2001:db8:1234:1a00::**** | |
Ipv6AddressCount | integer | No | The number of IPv6 addresses to randomly generate for the ENI. Valid values: 1 to 10. Note
To assign IPv6 addresses to the ENI, you must specify the Ipv6Addresses.N or Ipv6AddressCount parameter, but not both.
| 1 |
Ipv4Prefix | array | No | IPv4 prefix N to assign to the ENI. Valid values of N: 1 to 10. Note
To assign IPv4 prefixes to the ENI, you must specify the Ipv4Prefix.N or Ipv4PrefixCount parameter, but not both.
| |
string | No | IPv4 prefix N to assign to the ENI. Valid values of N: 1 to 10. Note
To assign IPv4 prefixes to the ENI, you must specify the Ipv4Prefix.N or Ipv4PrefixCount parameter, but not both.
| hide | |
Ipv4PrefixCount | integer | No | IPv4 prefix N to assign to the ENI. Valid values: 1 to 10. Note
To assign IPv4 prefixes to the ENI, you must specify the Ipv4Prefix.N or Ipv4PrefixCount parameter, but not both.
| hide |
Ipv6Prefix | array | No | IPv6 prefix N to assign to the ENI. Valid values of N: 1 to 10. Note
To assign IPv6 prefixes to the ENI, you must specify the Ipv6Prefix.N or Ipv6PrefixCount parameter, but not both.
| |
string | No | IPv6 prefix N to assign to the ENI. Valid values of N: 1 to 10. Note
To assign IPv6 prefixes to the ENI, you must specify the Ipv6Prefix.N or Ipv6PrefixCount parameter, but not both.
| hide | |
Ipv6PrefixCount | integer | No | IPv6 prefix N to assign to the ENI. Valid values: 1 to 10. Note
To assign IPv6 prefixes to the ENI, you must specify the Ipv6Prefix.N or Ipv6PrefixCount parameter, but not both.
| hide |
DeleteOnRelease | boolean | No | Specifies whether to release the ENI when the associated instance is released. Valid values:
| true |
Response parameters
Examples
Sample success responses
JSON
format
{
"Status": "Available",
"Type": "Secondary",
"VpcId": "vpc-bp1j7w3gc1cexjqd****",
"NetworkInterfaceName": "my-eni-name",
"MacAddress": "00:16:3e:12:**:**",
"NetworkInterfaceId": "eni-bp14v2sdd3v8htln****",
"ServiceID": 12345678910,
"OwnerId": "123456****",
"ServiceManaged": true,
"VSwitchId": "vsw-bp16usj2p27htro3****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
"Description": "testDescription",
"ResourceGroupId": "rg-2ze88m67qx5z****",
"ZoneId": "cn-hangzhou-e",
"PrivateIpAddress": "172.17.**.**",
"SecurityGroupIds": {
"SecurityGroupId": [
"sg-bp18kz60mefsicfg****"
]
},
"PrivateIpSets": {
"PrivateIpSet": [
{
"PrivateIpAddress": "172.17.**.**",
"Primary": true
}
]
},
"Tags": {
"Tag": [
{
"TagValue": "TestValue",
"TagKey": "TestKey"
}
]
},
"Ipv6Sets": {
"Ipv6Set": [
{
"Ipv6Address": "2001:db8:1234:1a00::****"
}
]
},
"Ipv4PrefixSets": {
"Ipv4PrefixSet": [
{
"Ipv4Prefix": "hide"
}
]
},
"Ipv6PrefixSets": {
"Ipv6PrefixSet": [
{
"Ipv6Prefix": "hide"
}
]
}
}
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 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | The specified tag key already exists. Tag keys must be unique. |
400 | InvalidTagKey.Malformed | The specified Tag.n.Key is not valid. | The specified Tag.N.Key parameter is invalid. |
400 | InvalidTagValue.Malformed | The specified Tag.n.Value is not valid. | The specified tag value is invalid. |
400 | InvalidOperation.EniCountExceeded | The maximum number of eni in a enterprise security group is exceeded. | - |
400 | IncorrectVSwitchStatus | The current status of vSwitch does not support this operation. | - |
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 | InvalidParameter.SecurityGroupIdRepeated | %s | - |
400 | InvalidSecurityGroupId.SingleIdAndMultiIdConflict | %s | - |
400 | InvalidPrivateIpAddress.Duplicated | Specified private IP address is duplicated. | The specified private IP address is already in use. Try a different IP address. |
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 | QuotaExceeded.PrivateIpAddress | There is no enough private ip in the specified VSwitch. | - |
400 | IncorrectVSwitchStatus | The current status of virtual switch does not support this operation. | The specified vSwitch is in the Pending state and cannot be deleted. |
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. |
403 | InvalidOperation.NotSupport | The specified region is not support to allocate ipv6 when create network interface. | - |
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 | InValidParameter | %s | The specified parameter is invalid. |
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 | InvalidVSwitchId.IpNotEnough | %s | The number of available IP addresses on the specified vSwitch is insufficient. |
403 | InvalidVSwitchId.IpInvalid | %s | The specified private IP address is invalid. |
403 | QuotaExceed.Tags | %s | The number of specified tags exceeds the upper limit. %s is a variable. An error message is dynamically returned based on call conditions. |
403 | EnterpriseGroupLimited.MutliGroupType | The specified instance can't join multi SecurityGroup types. | - |
403 | InvalidIp.Address | %s | - |
403 | InvalidIp.IpRepeated | %s | The specified IP address already exists. |
403 | MaxEniPrivateIpsCountExceeded | %s | The maximum number of secondary private IP addresses that can be assigned to the specified ENI has been exceeded. For more information, see the return value of the %s placeholder in the error message. |
403 | InvalidOperation.ResourceManagedByCloudProduct | %s | You cannot modify security groups managed by cloud services. |
403 | InvalidOperation.TrunkingIsNotAllowed | %s | - |
403 | InvalidParameter.InvalidEniQueueNumber | %s | - |
403 | InvalidOperation.MaxEniQueueNumberExceeded | %s | - |
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 | InvalidOperation.BoundingEniSlaveQuotaExceed | The slave eni quota above bounding eni exceeds. | - |
403 | InvalidParameter.EniTrafficMode | %s | - |
403 | InvalidOperation.HighPerformanceTrafficModeIsNotAllowed | %s | - |
403 | InvalidParameter.QueuePairNumberMustEmpty | %s | - |
403 | InvalidParameter.InvalidQueuePairNumber | %s | - |
403 | InvalidParameter.EniTrafficMode | The eni business type not support HighPerformance traffic mode. | - |
403 | InvalidParams.NetworkInterfaceName | %s | - |
403 | InvalidIp.IpPrefixMaskNotSame | The ip prefixes %s are illegal which mask must be same. | The IP address prefix masks are not the same. |
403 | InvalidIp.IpPrefixMaskInvalid | The ip prefixes mask %s is illegal which must be between %s and %s. | The IP address prefix mask is invalid and is not within the valid range. |
403 | InvalidIp.IpPrefixMaskIllegal | The ip prefix mask is illegal. | The IP address prefix mask is invalid. |
403 | InvalidIp.IpPrefixIllegal | The ip prefixes %s is/are illegal. | The IP address prefix is invalid and is not in the CIDR format. |
403 | InvalidIp.IpPrefixMustInReserveSegment | The ip prefix must in vswitch reserve segment. | The IP address prefix is invalid and is not in the reserved CIDR block of the vSwitch. |
403 | InvalidIp.IpPrefixNotAvailable | The ip prefix is/are not available. | The IP address prefix is not available. |
403 | InvalidIp.IpPrefixNotStrict | The ip prefix must be strict cidr format. | The IP address prefix is invalid and is not in the CIDR format. |
403 | InvalidVSwitchId.IpPrefixNotEnough | The specified vSwitch has not enough ip prefix. | The number of IP address prefixes in the specified vSwitch is insufficient. |
403 | InvalidOperation.Ipv4CountExceeded | %s | The operation is valid because the maximum number of IPv4 addresses has been reached. |
403 | InvalidOperation.Ipv6CountExceeded | %s | The operation is valid because the maximum number of IPv6 addresses has been reached. |
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. |
404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | The specified resource group does not exist. |
404 | InvalidVSwitchId.NotFound | The specified VSwitchId is not found. | - |
404 | InvalidOperation.MaxEniIpv6IpsCountExceeded | The ipv6 address count exceed limitation. | - |
404 | InvalidOperation.VSwitchIpv6Disabled | The specified VSwitch does not support Ipv6 feature. | The specified VSwitch does not support IPv6. |
404 | InvalidOperation.EnableIpv6Failed | The specified VSwitch does not support Ipv6 feature. | - |
404 | InvalidOperation.AddressAlreadyAllocated | The specified ipv6 has been already allocated. | - |
404 | InvalidOperation.AddressNotInVSwitchCidr | The specified ipv6 does not match VSwitch cidr scope. | - |
404 | InvalidOperation.EniTrafficModeNotSupportIpv6 | The High Performance traffic mode does not support Ipv6. | - |
404 | InvalidOperation.MaxEniIpv6IpsCountExceeded | %s | - |
404 | InvalidOperation.AddressAlreadyAllocated | The specified ip address has been already allocated. | The specified IP address is already in use. |
404 | InvalidOperation.SlaveEniMustHaveBondingEni | Create slave eni must have bonding eni first. | - |
404 | InvalidOperation.VSwitchCidrReservationNotExist | The specified vSwitch has no cidr reservation. | - |
500 | InternalError | The request processing has failed due to some unknown error, exception or failure. | An internal error has occurred. Try again later. |
500 | InvalidOperation.RegionNotSupportIpPrefix | The current region does not support ip prefix. | You cannot assign IP address prefixes in this region. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2024-02-28 | The Error code has changed | see changesets | ||||||||||||||||||
| ||||||||||||||||||||
2024-01-24 | The Error code has changed. The request parameters of the API has changed | see changesets | ||||||||||||||||||
| ||||||||||||||||||||
2023-10-09 | The Error code has changed. The request parameters of the API has changed | see changesets | ||||||||||||||||||
| ||||||||||||||||||||
2023-04-26 | The Error code has changed | see changesets | ||||||||||||||||||
| ||||||||||||||||||||
2021-07-05 | The Error code has changed. The request parameters of the API has changed. The response structure of the API has changed | see changesets | ||||||||||||||||||
|