Elastic Network Interface
Get a working knowledge of the elastic network interface in EC2.
We'll cover the following
Communication between different network elements relies on the network interface, a component designed to communicate over the network. Each server requires a network interface to be a part of a network. A network interface has two different addresses: Private IP to communicate within the network and Public IP for outside the network. Similarly, in AWS, the communication of EC2 instances depends on the Elastic network interface. In this lesson, we will learn about the Elastic network interface in detail and explore how it works with an example.
What is ENI?
An Elastic Network Interface (ENI), also known as a Network Interface, is a virtual network card that can be attached to the EC2 instances. ENI is a logical networking component that can be used to provide multiple IP addresses or attach an instance to different subnets. An Elastic Network Interface (ENI) in AWS is associated with an Availability Zone (AZ) in a region. This means that we can attach and detach the ENI to different instances within the same Availability Zone.
Every instance launched has a default network interface, known as the primary network interface; by default, it offers a private IP address to the instance. However, it can be configured to offer the public as well as the elastic IP address. A primary network interface can not be detached from an instance. However, we can attach more network interfaces to an instance. The number of network interfaces that can be attached to an instance depends upon the instance type and size. For example, m1.xlarge
can have up to 4 network interfaces; similarly, t2.micro
can have 2 network interfaces maximum.
Types of IP addresses
IP addresses serve as the digital equivalent of addresses in the physical world, as the home address identifies a location in the physical world. Similarly, IP addresses uniquely identify an instance in the network. ENI offers different types of IP addresses, each offering a unique set of characteristics. The three different types of IP addresses are: Public, Private, and Elastic IP address.
Public IP addresses are used to communicate over the internet, whereas private IP addresses are essential for communicating within a
AWS allows us to control whether an instance in the network receives a Public IP address or not. Sometimes, we do not want our instance to communicate with the internet directly to make it more secure. The public IP address of instances is not static by default; it is associated with the instance until it’s stopped or terminated. When we require a persistent IP address, especially when hosting a web application, we use an Elastic IP address. An Elastic IP address offers a static public IP that can be attached directly to an EC2 instance or a network interface. The elastic IP address remains associated until removed and attached to a different instance or a network interface.
Example: Web application
Let’s look at a real-world scenario that explains the importance of different types of IPs. Consider an e-commerce website that uses Three ENIs for a secure and reliable network architecture to handle customer orders, manage product inventory, and process payments.
Public ENI: Connects to a public subnet. This ENI hosts the website frontend, allowing customers to browse products and place orders.
Private ENI: Connects to a private subnet. This ENI hosts the website backend, including the product database, order processing system, and payment gateway integration. It communicates securely with the public ENI for order details.
Admin ENI: Connects to an isolated admin subnet. This ENI allows system administrators secure access to manage the website’s backend servers and databases.
ENIs and subnets allow the e-commerce store to create a secure and reliable network infrastructure for its e-commerce website. It isolates customer data, implements granular security policies, and enables service migration for increased reliability and customer satisfaction.
Get hands-on with 1300+ tech skills courses.