Assign or unassign IPv4 and IPv6 address ranges in CIDR notation to ENIs for efficient IP management.
Benefits
IP prefixes provide the following benefits:
More efficient IP address management.
Faster IP address assignment and higher IP capacity per ECS instance.
More IP addresses per node in multi-IP container networks, simplifying CIDR block management.
Limitations
Note the following limitations:
Region
IP prefixes are available only in the Singapore, US (Silicon Valley), US (Virginia), Philippines (Manila), Germany (Frankfurt), UK (London), Malaysia (Kuala Lumpur), Thailand (Bangkok), Indonesia (Jakarta), Japan (Tokyo), South Korea (Seoul), UAE (Dubai), SAU (Riyadh - Partner Region), China (Qingdao), China (Beijing), China (Hangzhou), China (Shenzhen), China (Shanghai), China (Hong Kong), China (Hohhot), China (Chengdu), China (Heyuan), China (Ulanqab), and China (Guangzhou) regions.
Scope
The IP prefix must fall within the CIDR block of the vSwitch where the ENI resides. See Reserved CIDR block.
IP addresses
Note the following when you assign an IP prefix:
The subnet mask for IPv4 prefixes is /28; for IPv6 prefixes, /80.
The IP prefix must be a standard CIDR block.
The IP prefix must be in the reserved CIDR block of a vSwitch and must not overlap with existing IP prefixes or IP addresses.
Number of IP prefixes
You can assign up to 9 IP prefixes to an available ENI in the ECS console, or up to 49 by calling the AssignPrivateIpAddresses operation.
The number of IP prefixes assignable to an in-use ENI varies by instance type. Each IP prefix counts as one IP address. Example:
An ecs.g7.large instance supports up to six private IPv4 addresses per ENI, including one primary address. Without secondary IPv4 addresses, you can assign up to five IPv4 prefixes. Each additional secondary IPv4 address reduces the available prefix slots by one.
An ecs.g7.large instance supports up to six IPv6 addresses per ENI. Without existing IPv6 addresses, you can assign up to six IPv6 prefixes.
Each additional IPv6 address reduces the available IPv6 prefix slots by one.
See the IP-per-ENI columns in Instance family.
Security group
IP prefixes assigned to an ENI count against the IP address quota of the associated security group. The quota varies by security group type in a VPC.
A basic security group supports up to 6,000 private IP addresses. If no other IP addresses exist, you can assign up to 6,000 IP prefixes.
An advanced security group supports up to 65,536 private IP addresses. If no other IP addresses exist, you can assign up to 65,536 IP prefixes.
Use IP prefixes
Assign IP prefixes to ENIs
Scenario 1: Assign an IP prefix to an existing ENI
Use the ECS console
On the Elastic Network Interfaces page, enter the IPv4 prefix to assign. If left empty, an IPv4 prefix is automatically assigned. See Secondary private IPs.
NoteAfter the IP prefix is assigned, configure secondary IP addresses on the ECS instance. For IPv4, see Secondary private IPs. For IPv6, see IPv6 connectivity.
After you bind an ENI with an IP prefix to an ECS instance, some images cannot automatically identify IP addresses on secondary ENIs. In this case, configure ENIs on the instance. See Configure a secondary ENI.
Call API operations
Manually assign IP prefixes
Call the AssignPrivateIpAddresses operation and specify
Ipv4Prefix.Nto assign one or more IPv4 prefixes. Valid values of N: 1 to 10.Call the AssignIpv6Addresses operation and specify
Ipv6Prefix.Nto assign one or more IPv6 prefixes. Valid values of N: 1 to 10.
Automatically assign IP prefixes
Call the AssignPrivateIpAddresses operation and specify
Ipv4PrefixCountto have the system assign a specific number of IPv4 prefixes. Valid values: 1 to 10.Call the AssignIpv6Addresses operation and specify
Ipv6PrefixCountto have the system assign a specific number of IPv6 prefixes. Valid values: 1 to 10.
Scenario 2: Assign IP prefixes when you create an ENI
Use the ECS console
When you create an ENI, select Specify IPv4 Prefix for Secondary Private IPv4 Address and enter the IPv4 prefix on the Create ENI page.
NoteAfter the IP prefix is assigned, bind the ENI (in Available state) to an ECS instance, then configure secondary IP addresses. For IPv4, see Secondary private IPs. For IPv6, see IPv6 connectivity.
After you bind an ENI with an IP prefix to an ECS instance, some images cannot automatically identify IP addresses on secondary ENIs. In this case, configure ENIs on the instance. See Configure a secondary ENI.
Call API operations
Call the CreateNetworkInterface operation and specify the corresponding parameter to assign IP prefixes.
Specify
Ipv4Prefix.NorIpv6Prefix.Nto assign specific IPv4 or IPv6 prefixes.Specify
Ipv4PrefixCountorIpv6PrefixCountto have the system assign a specific number of IPv4 or IPv6 prefixes.
View the IP prefixes of ENIs
Use the ECS console
In the upper-left corner of the page, select a region and resource group.
On the ENIs page, find the target ENI and click Manage ENI IP Addresses in the Operation column to view its IP prefixes.

Call API operations
Call the DescribeNetworkInterfaces operation to view IP prefixes of multiple ENIs.
Call the DescribeNetworkInterfaceAttribute operation to view IP prefixes of a single ENI.
Unassign IP prefixes from ENIs
You can unassign IP prefixes and reassign them to other resources.
Use the ECS console
Unassign IP prefixes on the Elastic Network Interfaces page. See Secondary private IPs.

Call API operations
Call the UnassignPrivateIpAddresses operation and specify
Ipv4Prefixto unassign one or more IPv4 prefixes.Call the UnassignIpv6Addresses operation and specify
Ipv6Prefixto unassign one or more IPv6 prefixes.
References
To modify ECS instance security group rules, see Modify a security group rule.
Configure event notifications in EventBridge or CloudMonitor to receive notifications about IP prefix assignment or unassignment. Notifications include ENI ID and prefix details. You can automate responses to these events. See Elastic Computing Service events and Subscribe to ECS system event notifications.