How to use Elastic Network Interface on EC2 Instances over VPC

Vijayaraghavan Vashudevan
3 min readAug 6, 2023

--

ENI Use case

๐ŸŽˆIn this use case, we will see how to use ENI on EC2 instances over the Virtual Private Cloud (VPC).

๐Ÿ’  Overview of Elastic Network Interface

๐Ÿ“ An Elastic Network Interface (ENI) is a virtual network interface that you can attach to instances in the Amazon Elastic Compute Cloud (Amazon EC2) service. It functions like a network interface card (NIC) and provides networking capabilities to the EC2 instances, allowing them to communicate with other resources in the same Virtual Private Cloud (VPC) or over the internet.

๐Ÿ“ Each ENI is assigned a private IP address from the subnet it is associated with. Additionally, ENIs can also have public IP addresses for instances that need to communicate with the internet directly. ENIs can be managed and configured independently, allowing you to customize the networking setup of your EC2 instances.

๐ŸŽ„ Here are some key uses of Elastic Network Interfaces:

  1. High Availability and Failover: ENIs can be used for high availability setups, such as configuring a primary and secondary instance with a floating IP address. In case the primary instance fails, you can quickly switch the IP address to the secondary instance, ensuring minimal downtime.
  2. Load Balancing: Elastic Load Balancing (ELB) can distribute incoming traffic across multiple instances attached to ENIs, helping to scale and distribute the load evenly among your instances.
  3. Network Segmentation: By attaching multiple ENIs to an EC2 instance, you can segment network traffic, such as dedicating one ENI for public-facing traffic and another for private/internal communications.
  4. Virtual Firewalls: ENIs can be used to implement security groups and network access control lists (ACLs) to control inbound and outbound traffic to and from your instances.
  5. Private Connectivity: ENIs can be used for instances to communicate privately with other instances within the same VPC or over a VPC peering connection.
  6. Elastic IP Addresses: You can associate an Elastic IP address with an ENI to ensure that your instance retains the same public IP address even if itโ€™s stopped and started again.
  7. Network Monitoring and Analysis: ENIs provide network-level monitoring and can be used to capture and analyze network traffic using tools like Amazon VPC Traffic Mirroring.

๐Ÿ’ซ Here are some of the benefits of using Elastic Network Interfaces:

  • High availability: ENIs are highly available. If one ENI fails, another ENI will automatically take its place.
  • Scalability: ENIs are scalable. You can easily add or remove ENIs from your EC2 instances as needed.
  • Flexibility: ENIs can be used to connect to a variety of AWS services and networks.

Overall, Elastic Network Interfaces are a powerful tool that can be used to connect your EC2 instances to a VPC and to other AWS services. They are highly available, scalable, and flexible, making them a valuable resource for any AWS user.

๐Ÿ“ขHands-on Demo

๐ŸŒŠ With this, we will see the demo of how to use the ENI in EC2 Instances to connect over the VPCโ€™s.

๐ŸŒInstructions to clean up AWS resource to avoid Billing

๐Ÿ“Œ Delete the EC2 Instances created

Thanks for being patient and followed me. Keep supporting ๐Ÿ™

Clap๐Ÿ‘ if you liked the blog

For more exercises โ€” pls do follow me below โœ…!

https://www.linkedin.com/in/vijayaraghavanvashudevan/

#AWS #AWSCommunityBuilder #AWSreSkill #EC2 #ElasticNetworkInterface #VPC #subnet #ENI

--

--

Vijayaraghavan Vashudevan

Hi Everyone !! Am here to publish the technical topics for the community which includes cloud concepts, postman, automation, RPA etc. Please do follow me :)