Hi and welcome to this video.
I'm going to show you how to set up an elastic IP.
Now, how is differs from a public IP address is where do you see two instances?
You can give it a public IP.
But if the instance is restarted, then that IP address changes.
And if you're using it as a Web server and you've got a domain pointing to that public IP, the last
thing you want is that IP address to change.
So what you can do is use an elastic IP and Amazon, have a block of public IP addresses that are available.
And what we can do with the IP is request it and just sit on it.
We don't actually have to use it.
That's not what we're going to do in this lesson or we're actually going to do is attach it to an easy
two instance.
And what I want to quickly do is also show you the documentation.
So here we have the documentation and it all looks fairly straightforward as a couple of other options.
But notice here that in all the argument references, people say optional squares before we've had required
fields.
So something that absolutely has to be in there with an E IP or elastic IP.
We don't actually have to set it.
We can simply in a terrifying code, creates it, but not use it.
And the way we're going to attach it is to passing the easy to instance I.D..
So now let's go to Visual Studio Code.
And go ahead and implement this to start.
I'm going to create a new folder and I'm going to call it E IP to speed things up.
I'm going to copy the main dot to your file and paste it inside the IP.
Next, do you want to add our elastic IP?
So we do with resource.
Eight of us unschool VIP.
And I'm going to call this elastic VIP.
And again, to attach it's what we need to do is set the instance equal to.
And this is one of those things that when you recognize the person, everything is going to make sense.
It's always a resource.
The resource name and the attribute.
So we go back to the documentation again.
If we scroll all the way down.
We see we have attributes.
And there we go.
We can see we have the attribute I.D. that gives the instance I.D..
So let's go back over to V.S. Code and type in.
As we said, it's going to be the resource name.
So it's a W.S. on the school instance, dot the name, which is easy to dot and the attribute this case.
We said it's I.D..
And as you've seen before, the output's let's add one for the public IP.
So let's set the outputs.
But outputs.
This VIP.
And we'll set value equal to, as you see here, it's eight of us on the school VIP dot, the resource
name, which we said is a plastic.
VIP dot.
And now we need the attribute.
So let's again check the documentation.
And as you can see here, the attribute we want to use is public IP.
So let's go ahead and use that public underscore IP.
I keep jumping back and forth between the documentation because I wanted to get a feel for when you
do this in the real world, because at the moment we're doing it with an E IP and an easy two instance.
But when you're setting up much more complex stuff, for example, cognito, I wanted to get a feel
for what it looks like when you go through the documentation and the sort of things you want to look
out for.
Now we've got everything set up.
Let's go to view and go to terminal and get back a level and c.D into VIP.
Now let's run Terra four minutes.
Excellent.
Now it's from Terra from Apply.
And now let's have a look at what is getting set up so you can see here we've got two items to change
so we can see also.
Here we have a big W.S. instance.
And we also have our LASTIC IP.
Now, what will happen with that?
Let's go ahead and say yes.
Excellent.
Very good.
So it's not only created every setu instance, it's also created our elastic IP.
It's also given us the IP address.
And it's also given us the IP address below.
So now it's all been set up.
Let's go ahead and destroy it.
Terraformed.
Destroy.
And this is what was really impulsive things because Yipes.
Can incur some cost, especially if you keep him up for a long time.
We'll keep hold of it.
So, Lindsay.
Yes.
And there we go.
That's no good to destroy our infrastructure.
That wraps up this video.
I look forward to seeing you in the next war.