Hi, everyone, and welcome back.
Now, in today's video, we are going to discuss about the basics of Elastic network interface, also
referred to as a E and A.
Now, before we discuss about E9, let's go ahead and revise the basics of network interface at a high
level overview.
Network interface is a hardware component that allows you to connect a computer to the computer network.
Now, generally, whenever you buy a laptop or a desktop, the motherboard has a network interface associated
with it through which you can go ahead and connect various external networks, maybe through LAN and
others.
Now, when we discuss about a virtualization environment, you have a concept of virtual network interface
also referred to as a Vive, which is nothing but an abstract virtualized representation of a computer
network interface.
So now let's go ahead and discuss the basics of Elastic Network interfaces at a high level overview.
Elastic Network Interface is a logical networking component in a VPC that represents the virtual network
card.
Now, when we discuss about E and A, there are certain attributes that are associated with it, one
of them being the primary private IPV four address.
Then you have a one or more secondary private IPV four address.
You can have an elastic IPV four address, you can have one or more security group, a mac address,
a source destination check flag as well.
Now this can also be seen through the diagram where you have an elastic network interface and there
are multiple attributes.
You have a private IP, you have a public IP, you have a mac address, you have a security group that
is associated with an E and A, and so on.
Now, before we go ahead and discuss things in more detail, let's go ahead and understand this specific
part.
Now, for today's demo, I have two EC2 instances that are running.
Now.
Whenever you go ahead and create an AC to instance, there is also an elastic network interface that
gets created and it gets associated with the EC two, for example, the instance one over here.
This instance one has multiple attributes, one of them being the private IP address, second being
the public IPV four address.
Then it has some kind of a security group and other things.
Now when you look into the network interface associated with the easy to instance, so in the network
interface, let's quickly open this up.
So this is the E nine.
Now, in this way, as you're discussing, you have a private IPV four, public IPV four, then you
have a specific security group that gets associated and so on.
Now, generally, whenever you associate a security group with an easy to instance behind the scenes,
that security group is associated with the network interface of that easy to this is one thing that
needs to be noted.
Now one more thing I just wanted to show you is that you can also create a network interface if you'd
like.
So for example, let's create a network interface.
I'll just call it a test and I'll just associate it with a specific subnet.
Now whenever you create a network interface, the private IPV four address, you can either auto assign
or you can add a custom.
I'll just auto assign.
And you also have an option to associate a security group here.
Let me just associated sample security group and I'll create a network interface.
All right.
So you see it states successfully created a network interface.
So a very simple way to create a NIC in a bus.
Now, one of the important features that you need to know specifically related to the E nine is that
of the portability.
This means that whenever you create an E, nine in eight of us, you can attach that E to a EC two instance.
You can also detach that from that EC to instance and attach it to another AC two instance.
Now when you do that, the attributes of a network interface also follow it.
For example, in this diagram you have to EC two instance one of the EC two instance has a network interface.
Now let's say that you detach this network interface and attach it to one more easy to instance.
So all the attributes that this network interface had, including the private IP security group, all
these attributes will follow and these would be associated with the new EC two instance.
For example, the previous NIC header IP address of one 7231 0.5.
Now, when you detach this, Nic, from the instance one and you attach it to the instance to then this
private IP address will also be followed here.
So the new instance will get this specific IP address.
All right.
So let's go ahead and also look into this practically.
Now, we had already created a network interface, so let's go ahead and quickly find out because there
are four network interface here.
The description we had given test so you can check the description.
So here you have a description of taste.
So this is the network interface, I'll just call it as test hyphen nic and I'll click on Save.
Now this specific network interface has a specific private IP one 7231 26.92.
It has a security group and it is also in a.
The ability zone of one B, So let's go ahead and open up the e C to console once more.
Now for the E, C two instance that is also in the same availability zone.
Let's verify.
So the instance one here is in the availability zone of one B, So what we can do is we can associate
this test with this instance here.
So let's go ahead and try it out.
So I'll go ahead and attach this test, Nic, to the instance, number one, and I'll click on attach.
As soon as you have attached it.
Let's go ahead and quickly verify.
So for this specific instance here, you see that there are two network interfaces and there are also
two private IP addresses that are associated with it.
Now, you can also go ahead and verify it from the terminal.
Let's do that.
I'll copy the public IP.
Now from the easy to instance, if I quickly do an if config within here, you see that you have to
network interface.
This is the primary one and this is the additional network interface that we have associated.
Now, along with this, you can also associate an elastic IP with a specific network interface.
Let's also go ahead and look into it.
So whenever you create an elastic IP, let's do that.
Now this elastic IP, you can associate it, let's associate it now within under the resource type.
If we select the network interface, you can select our testing that we have created.
Then you can associate it here.
Now for the EC2 instance, let's go back for the EC two instance number one.
If you see there is a public IP and there is also elastic IP address associated with the instance and
you will be able to connect to them through both of these addresses.
Let's also try it out.
I'll copy the elastic IP.
I'll do a control D to log out.
Let's go ahead and try connecting through the elastic IP.
And you see, we are connected to the grid.
So I hope with this overview you understood the basics of the attributes that are associated with the
network interface, including the security group as well as the elastic IP.
Along with that, we were also discussing about a portability feature, so let's go ahead and try it
out.
So this easy too has this specific IP ending with two, four, four.
Let's go ahead and detach the network interface from that easy too.
So the test network interface that we have over here, we'll go ahead and detach it.
Let's do a force detachment just for simplicity.
And within year, if you look into the status of the test, Nick over here, let's see, the status
is still in use, so you'll have to wait for a moment for it to be available.
Let's refresh it one more time.
And you see it is now available.
Now you can go ahead and attach this testnet to instance, number two.
Let's attach it.
Now from the instance console, if you go to the instance number two, you see this IP address associated
with it is now associated with instance two.
And if you'd like to see there are two network interfaces and along with that you will also have two
sets of security group associated with the network interface.
Great.
So I hope with this you understood the basics of portability.
Now, before we conclude, there are certain important pointers that needs to be noted.
First one is that each instance has a default network interface, so whenever you create an easy to
default network interface is also associated with that easy too.
And that network interface is referred to as a primary network interface.
And you cannot detach a primary network interface from an instance.
Second important pointer is that you can go ahead and create and attach additional network interfaces.
This is something that we have already seen.
Also, the maximum number of network interface that you can use for an easy to it differs based on the
instance type as well.
It's not that you can associate a 50 or 100 network interface to a PT two micro instance, so there
are limits that are associated here.
And the last very important pointer is that the network interfaces are availability zone specific.
So you cannot have a network interface in availability zone one and associated with the EC two instance
in the availability zone two.
In fact, let me also quickly show you this.
Now, if you see both of our EC, two instances are in the availability zone of one B Now if you create
a network interface, let's quickly do that.
I'll just call it as demo in the description.
If I create a network interface in an availability zone one A let's just associate a security group
here.
Now our demo network interface is in one A.
Now if you try to attach it to the EC two instance, you see immediately you got an error stating no
running or stop instance in availability zone one A all of our EC two instances that are running are
in the one B region and this is the reason why you are not able to associate it with any of the EC two
grid.
So these are some of the important pointers related to the Elastic Network interfaces and with this
will conclude today's video.