You can assign one or more secondary private IP addresses to a primary or secondary elastic network interface (ENI). This topic describes how to assign secondary private IP addresses and configure secondary private IP addresses in an Elastic Compute Service (ECS) instance.
Background information
- Scenarios that involve multiple applications: If your instance hosts multiple applications, you can assign secondary private IP addresses to the applications so that each application can use a separate IP address for outbound connections. This way, a single instance can provide multiple services optimally.
- Failover scenarios: If an instance fails, you can unbind ENIs from the instance and bind the ENIs to another instance so that traffic destined for the secondary private IP addresses of the failed instance is diverted to the normal instance. This ensures service continuity.
- Limits on security groups: A limited number of private IP addresses can be contained in a security group of the Virtual Private Cloud (VPC) type. For more information, see the "Security group limits" section in Limits.
- Limits on ENIs: The maximum number of private IP addresses that can be assigned to
an ENI varies based on the state of the ENI.
- For an ENI in the Available state, up to 10 private IP addresses can be assigned.
- For an ENI in the Bound state, the maximum number of private IP addresses that can be assigned is subject to the instance type of the associated instance. For more information, see Instance family.
Procedure
Assign secondary private IP addresses on the Network Interfaces page
Assign secondary private IP addresses on the Instances page
When you assign secondary private IP addresses for an instance on the Instances page, the IP addresses are assigned to the primary ENI of the instance.
Assign secondary private IP addresses on the Security Groups page
Configure secondary private IPv4 addresses in a Windows instance
If a Windows instance cannot access the Internet after you configure secondary private IP addresses for the instance, troubleshoot the problem by following the instructions in After I configure a secondary private IP address for a Windows instance, the instance cannot connect to the Internet. Why?
Configure secondary private IPv4 addresses in a Linux instance that runs a Red Hat Enterprise Linux (RHEL) operating system
- This procedure applies to the following operating systems: Alibaba Cloud Linux 2, Alibaba Cloud Linux 3, CentOS 6, CentOS 7, CentOS 8, Red Hat 6, Red Hat 7, Red Hat 8, Anolis 7, Anolis 8, Fedora 33, and Fedora 34.
- In the following example, the eth0 primary ENI is used. If you are working with a secondary ENI, modify the ENI ID.
Configure secondary private IPv4 addresses in a Linux instance that runs a Debian operating system
- This procedure applies to the following operating systems: Ubuntu 18, Ubuntu 20, Ubuntu 14, Ubuntu16, Debian 8, Debian9, and Debian10.
- In the following example, the eth0 primary ENI is used. If you are working with a secondary ENI, modify the ENI ID.
Configure secondary private IPv4 addresses in a Linux instance that runs a SUSE Linux Enterprise Server (SLES) operating system
- This procedure applies to the following operating systems: SUSE 11, SUSE 12, SUSE 15, OpenSUSE 15, and OpenSUSE 42.
- In the following example, the eth0 primary ENI is used. If you are working with a secondary ENI, modify the ENI ID.