Read on:

AWS for Beginners: Understanding AWS Terminologies: Part 1
AWS for Beginners: What is AWS EC2: Part 2
AWS for Beginners: AWS Compute Services: Part 3
Read More

Amazon Elastic Network Interface (ENI) is a virtual networking component in the Amazon Elastic Compute Cloud (Amazon EC2) that represents a virtual network card. You can attach an ENI to an Amazon EC2 instance in a virtual private cloud (VPC), or to an instance in a subnet in a VPC. An ENI can be associated with a security group and have its own private IP address, MAC address, and security group rules.

Protect Your Data with BDRSuite

Cost-Effective Backup Solution for VMs, Servers, Endpoints, Cloud VMs & SaaS applications. Supports On-Premise, Remote, Hybrid and Cloud Backup, including Disaster Recovery, Ransomware Defense & more!

ENIs can be useful in a number of scenarios, including:

  • Attaching a secondary private IP address to an instance
  • Moving an instance to a different subnet within a VPC
  • Configuring network settings for an instance
  • Adding additional network interfaces to an instance

Each Amazon EC2 instance is automatically provided with a primary ENI, but you can also attach additional ENIs to an instance as needed.

AWS ENI

Download Banner

Creating a new ENI

To create a new Elastic Network Interface (ENI) in Amazon Web Services (AWS), you can use the AWS Management Console or the AWS command line interface (CLI). Here is an overview of the process:

1. Sign in to the AWS Management Console or open a terminal window and connect to the AWS CLI.

AWS ENI

2. From the main menu, select the “EC2” service.

AWS ENI

3. In the EC2 dashboard, select the “Network Interfaces” option in the left-hand menu.

AWS ENI

4. Click the “Create Network Interface” button.

5. On the “Create Elastic Network Interface” page, you will need to specify the following

Subnet: Choose the subnet in which you want to create the ENI.
Private IP address: You can specify a private IP address for the ENI or let AWS assign one automatically.
Description: Enter a description for the ENI.

AWS ENI

6. Security groups: Choose one or more security groups for the ENI.

AWS ENI

7. Click the “Create” button to create the ENI.

AWS ENI

We have successfully created a new ENI in AWS.

How to add secondary interface to the running EC2 instance?

1. After the ENI has been created, you can attach it to an Amazon Elastic Compute Cloud (EC2) instance or use it to add additional network interfaces to an existing instance.

Here is my running EC2 instance.

login as: ec2-user
Authenticating with public key “Vembu-Lenova”

__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|

https://aws.amazon.com/amazon-linux-2/
[ec2-user@ip-10-0-19-23 ~]$ sudo su –
[root@ip-10-0-19-23 ~]# ifconfig -a
eth0: flags=4163 mtu 9001
inet 10.0.19.23 netmask 255.255.240.0 broadcast 10.0.31.255
inet6 fe80::90:37ff:fe9d:abcf prefixlen 64 scopeid 0x20 ether 02:90:37:9d:ab:cf txqueuelen 1000 (Ethernet)
RX packets 12181 bytes 87239613 (83.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2848 bytes 226259 (220.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 48 bytes 3888 (3.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 48 bytes 3888 (3.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[root@ip-10-0-19-23 ~]#

2. Let me add the newly create ENI to the instance.

AWS ENI

3. Attach the secondary interface to the instance.

AWS ENI

4. Go back to EC2 instance and try to run “ifconfig” command. You can see that secondary interface populated in OS automatically.

[root@ip-10-0-19-23 ~]# ifconfig -a
eth0: flags=4163 mtu 9001
inet 10.0.19.23 netmask 255.255.240.0 broadcast 10.0.31.255
inet6 fe80::90:37ff:fe9d:abcf prefixlen 64 scopeid 0x20 ether 02:90:37:9d:ab:cf txqueuelen 1000 (Ethernet)
RX packets 12311 bytes 87247898 (83.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2963 bytes 239614 (233.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163 mtu 1500
inet6 fe80::4a:92ff:fede:79a7 prefixlen 64 scopeid 0x20 ether 02:4a:92:de:79:a7 txqueuelen 1000 (Ethernet)
RX packets 5 bytes 368 (368.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6 bytes 772 (772.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 48 bytes 3888 (3.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 48 bytes 3888 (3.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[root@ip-10-0-19-23 ~]#

Deleting an ENI

To delete an Elastic Network Interface (ENI) in Amazon Web Services (AWS), you can use the AWS Management Console or the AWS command line interface (CLI).

  • Sign in to the AWS Management Console or open a terminal window and connect to the AWS CLI
  • From the main menu, select the “EC2” service
  • In the EC2 dashboard, select the “Network Interfaces” option in the left-hand menu
  • In the list of ENIs, locate the ENI that you want to delete and select the checkbox next to its name
  • Click the “Actions” drop-down menu and select “Delete”
  • In the “Delete Elastic Network Interface” window, confirm that you want to delete the ENI by clicking the “Delete” button

Before you can delete an ENI, you must first detach it from any Amazon Elastic Compute Cloud (EC2) instances that it is attached to. If the ENI is associated with an AWS resource (such as an EC2 instance or a security group), you will need to remove the association before you can delete the ENI.

Otherwise, you might receive a warning like below.

AWS ENI

In Amazon Web Services (AWS), an Elastic Network Interface (ENI) is a virtual network interface that you can attach to an Amazon Elastic Compute Cloud (EC2) instance. An ENI allows an EC2 instance to communicate with other resources in the same virtual private cloud (VPC) or in a connected network, such as an on-premises network connected to the VPC through an AWS Direct Connect link.

An Amazon ENI has the following characteristics:

  • An ENI can be attached to an EC2 instance in the same VPC or in a different VPC within the same AWS account
  • An ENI can be in a subnet in a different availability zone from the EC2 instance to which it is attached
  • An ENI can be associated with one or more security groups
  • An ENI can be moved from one EC2 instance to another, allowing you to change the networking configuration of an EC2 instance without stopping or rebooting it
  • An ENI can have one or more private IP addresses and one or more public IP addresses or Elastic IP addresses (EIPs)

Conclusion:

You can use Amazon ENIs to configure the networking of an EC2 instance in a flexible and scalable way. For example, you can use ENIs to:

  • Add additional network interfaces to an EC2 instance to increase its network bandwidth or to enable it to connect to multiple VPCs or on-premises networks
  • Configure an EC2 instance with multiple private IP addresses to enable it to host multiple applications or to enable multiple network interfaces to share a single public IP address
  • Configure an EC2 instance with a public IP address or EIP to enable it to communicate with the Internet or to enable inbound traffic from the Internet to reach the instance
  • Configure an EC2 instance with a network interface in a different availability zone to enable it to communicate with resources in that availability zone


AWS for Beginners: How to Protect AWS Security Tools: Part 4
AWS for Beginners: What is IAM (Identity and Access Management) and Best Practices: Part 5
AWS for Beginners: Provisioning IAM Users and Programmatic Access in AWS: Part 6
AWS for Beginners: Securing Root account using MFA: Part 7
AWS for Beginners: Amazon S3 Overview, Security and Best Practices : Part 8
AWS for Beginners: Creating and managing IAM groups: Part 9
AWS for Beginners: AWS Managed Policies and In-line Policies: Part 10
AWS for Beginners: Create and Attach a policy to an IAM User: Part 11
AWS for Beginners: How to Create a Customer Managed Policy: Part 12
AWS for Beginners: What are EC2 Placement groups: Part 13
AWS for Beginners: ALB vs NLB vs GLB – Which AWS Load Balancer Should You Choose: Part 14
AWS for Beginners: What is AWS Elastic IP Address: Part 15

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Rate this post