How to Attach Multiple IP to ENI-Instance
Any instance when created comes with its default NI attached to it (eth0). The Elastic Network Interface (ENI) is a virtual interface and an additional ENIs can be created and attached to an instance or can be detached from it. The number of ENIs that can be attached to an EC2 instance depends on its type.
An ENI may have the following properties:
- One primary and multiple secondary IPv4 addresses and optionally, one public or Elastic (fixed) IPv4 IP
- One or more IPv6 addresses if supported by the instance type and network
- One MAC address
- Additional properties such as SG, source destination check, and so on.
- Create a Network Interface and attach it to ENI on Subnet DCLESSONS-SUBNET-2
- Select the Security Group DCELSSONS-SG-1 and associate with it.
Go to the AWS EC2 console and Choose Network Interfaces in the left navigation menu under Network & Security. In the dashboard, you can see the ENI that has already been created while creating the EC2 instance or the Elastic IP. Click on Create Network Interface:
- Provide the Description DCLESSONS-ENI-1 and select the Subnet DCLESSONS-SUBNET-2 to which it should be associated with. Choose the IPv4 Private IP and IPv6 IP that is allowed under the CIDR of the subnet. You can leave it and AWS will choose the IPs for you. Select the Security groups DCLESSONS-SG-1 that it should be associated with. SGs created in the VPC will be populated in the Security groups section. Click Yes, Create. We can change the Security Group associated with the ENI later.
- You can now see the Network Interface that was just created in the dashboard. You can see the status is available:
- Select the newly created ENI and click on attach and select the EC2 instance running.
- You can see that the status has changed to in-use