Elastic Network Interface
In this tutorial, we are going to explore about working knowledge of the elastic network interface in AWS EC2. An Elastic Network Interface (ENI) in AWS is a virtual network interface that you can attach to an EC2 instance in a Virtual Private Cloud (VPC). Elastic Network Interfaces are essential for managing networking resources within AWS, allowing you to have multiple network interfaces, IP addresses, and network-related configurations on a single EC2 instance.
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 tutorial, we will learn about the Elastic network interface in detail and explore how it works with an example.
What is Elastic Network Interface?
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 theprimary 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 VPC. Each instance in the network has a unique private IP address that is used as the identifier for that instance.
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 Elastic Network Interface hosts the website frontend, allowing customers to browse products and place orders.
- Private ENI:Â Connects to a private subnet. This Elastic Network Interface 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 Elastic Network Interface 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.
Key Features and Benefits of ENIs
1. Multiple IP Addresses
- ENIs allow an instance to have multiple private and public IP addresses.
- You can assign a primary private IP and multiple secondary private IP addresses to a single ENI.
- Useful for applications that require multiple IP addresses, like hosting different websites on the same server.
2. Enhanced Availability and Failover
- You can attach a secondary ENI to an instance for redundancy, so if the primary ENI fails, you can quickly switch to the secondary one.
- ENIs can also be transferred between instances, which is useful for quick recovery in case of instance failure.
3. MAC Address and Security Groups
- Each ENI has its own unique MAC address, security group, and network ACLs.
- This feature allows you to have different security group rules and network ACLs for each ENI on the same instance, providing greater control over network traffic.
4. Elastic IP Association
- You can associate an Elastic IP with an ENI, which provides a fixed public IP for your instance.
- This is useful if you need a static IP for services that require a consistent address, like DNS entries.
5. Multiple Network Interfaces
- Attaching multiple ENIs to an instance allows it to be connected to multiple subnets or VPCs, which is beneficial for scenarios where an instance needs to communicate across different network zones.
ENIs offer flexibility in managing your network architecture within AWS, allowing you to build more robust, scalable, and fault-tolerant applications. Let me know if you need more details on a particular ENI feature!
That’s all about working knowledge of the elastic network interface in AWS EC2. If you have any queries or feedback, please write us at contact@waytoeasylearn.com. Enjoy learning, Enjoy AWS Tutorials.!!