You are on page 1of 2

I just mentioned

that VMs can have internal and external


IP addresses. Let's explore this
in the GCP Console. So here I am on the
Compute Engine page. What I'm going to do is just
create a VM and walk through the process of choosing your internal and
external IP address. So let me click Create. I can leave the name. You have
obviously a selection of regions and zones
you can choose, but I want to focus
on the IP addresses. So let me go down to this option, expand management security
networking sole tenancy. Let's focus on networking. Here at the network interface,
I'm going to click
the pencil icon. I could choose between
two different networks. So if I had different networks, I could choose between
them. That's not the case here. Then I have the primary or
internal IP and external IP. So if we look at those options, you can see that I can
use an ephemeral address
either the one that's created automatically or I could custom select one. So within
the range
that I have here I could just type IP address. I could also reserve a
static internal IP address. This is great if you want
to keep that IP address for a longer time and we have similar options with
the external IP address. But one of the big
differences is that you can also just select none. So as I mentioned your
instances don't need to have an external IP address. So let's just leave
this as ephemeral. By the way, with the slash
20 here we have a lot of space in this IP range
over 4,000 addresses. So we could definitely
have that many instances. There are also limits
of how many instances you can have per network. As of this recording
is actually 15,000. So do keep that in mind you might have a very large IP range
but that doesn't mean that you actually can create
that many instances. That's a quota. There may also be actual
limitations on physical hardware that's even available within
a specific region or zone. So let me go ahead and
create this instance. We're going to keep an eye on the internal and as well as
the external IP address. Once the instance is created. Then we're also going
to stop and start the instance to see if any of
the IP address has changed. So here we can see the
internal IP address. So that is definitely within that space that we
just looked at. The external IP
address obviously is within Google strange here and we could have reserved that,
but this is an fMRL one. So let's actually test this out. I'm going to select the
instance. I'm going to stop it. So it's telling me
that it doesn't move in 90 seconds
that might be forced. So if you had any shutdown
scripts in here you want to make sure that
they can actually complete within 90 seconds. So let's run through that. Remember
this external IP
address that we currently have here as well as the
internal IP address. So this is going to
take it's time now. We can also click Refresh
to keep an eye on this. But this will take
about 90 seconds, and that's just to give your shutdown script enough time to
perform any task to gracefully
shut down this instance. So here we are, we can see
the instance is stopped, the external IP address is gone. So now we're just going
to
startup that instance again. It's going to tell us it
we're going to be build while it's running, that's fine. You can see that the
internal IP address remained the same wildest
instance stopped. So that has actually
stayed for the time being. Now, while this instance
spins up which we can by the way monitor the
progress over here, we should see that
we should be getting a new external IP address now because that was an
ephemeral address. So here we can see the instance
has started back up and we can see that the external
IP address has changed. This demonstrates that every VM needs an internal IP
address but external IP addresses are optional and by default,
there are ephemeral.

You might also like