Okay.
So we are going to learn how
to SSH into our EC2 Instance using Windows.
And for this, we used to say, what is SSH?
Well, SSH to me is one of the most important function,
especially when you deal with Amazon cloud.
It will basically allow you to control a machine remotely
all using the command line.
Okay.
And so what does it look like?
Well, basically we have our EC2 machine,
and it's running Amazon Linux 2, and it has a public IP.
And I don't know if you remember,
but we had an SSH security group on it.
And basically we allowed SSH on port 22 to any IP,
which basically allows our Windows machine to connect
over the internet directly into the machine
and control it using the command line.
So we'll see how to do the requirements for parameterizing
basically our Windows.
And so we'll use PuTTY to do SSH.
So this is a free tool available online.
And as you can see,
it's a little bit tricky to use the first time,
but we'll get used to it,
and we'll learn how to SSH into Windows,
into Linux using PuTTY.
So let's get started.
Okay.
So we are going to SSH
into our EC2 Instance and I'm running on Windows.
And for this, I assume that you have Windows 7,
or Windows 8, or an older version Window.
If you have Windows 10,
there is an alternative in the next lecture, both work.
Okay.
So let's try for, even if you're on Windows 10
you can do this technique.
So for this, you would go and download PuTTY.
So PuTTY is a free SSH client for Windows.
So download PuTTY.
And then I will choose, for example,
the 64 bits installer, the first one.
Then I go ahead.
I perform the install of PuTTY.
So next, next, yes.
And yes, I want to install PuTTY.
Perfect.
So PuTTY is installed.
And I have to install PuTTY.
So, we have two things here on PuTTY.
We have the PuTTY app, as well as PuTTYgen.
So let's first open PuTTYgen.
And in case you did not download your file
in the PPK format, you can actually generate the PPK format
directly from here.
So let me show you how it's done.
So, I need to go ahead and load my file.
So I click on load, and then find where my file is.
So for me, it's on my desktop.
And you can see, I see nothing,
but if I go to the bottom right, and show all files
I will find my EC2 tutorial in the PEM format.
So I can select it.
It says, okay, you have successfully imported this.
And then you can save it as a private key.
So click on save private key.
And said you wanna have a pathways, you say,
if you don't wanna have path, you say yes.
And then you save it on your desktop.
So EC2tutorial.PPK
Now your file is saved
and you have converted successfully
a PEM file into the PPK format.
If you have done this already, then you're good to go.
Next, we need to set up PuTTY
to access our EC2 Instance.
So, this time you open the PuTTY app,
and here we have to enter a host name
or an IP address of where we are trying to connect.
So this we know it's My First Instance.
You copy the public IPv4 address.
You paste it.
And it's SSH.
You're going to save this under EC2 Instance.
And then you click on save, but we're not done just yet.
Okay.
We need to specify the key itself.
So let's specify the key in here.
So, you have it saved under EC2 Instance.
I double clicked.
So as you can see, I have to accept this.
So if we accept because we trust the host,
we say, yes, accept.
But we still have the login as prompt and it will not work.
So if I do, for example, EC2 user, it says okay,
I cannot authenticate right now.
So for this, we go back into PuTTY,
and we're going to fix things.
So click on EC2 Instance and load this profile.
The first thing I'm going to add is in the host name.
I have EC2 minus user at the IP.
So the IP is where we access our server,
and the EC2 user is a user already created for us
on Amazon Linux 2.
So I can click on save again.
So we're done in here.
This will be saved.
And then for the key, we need to go into the SSH.
You click the plus, you have the Auth,
you click the plus, excuse me, no need to click the plus.
So you just click on Auth,
and then you need to find a private key file
for authentication.
Click on browse, go to your desktop.
And then you find the EC2 tutorial, that PPK file,
you have just generated using Puttygen.
Or, if you had downloaded it already
from the AWS console, that works as well.
So this file is good.
Don't click on open just yet, go back to session,
and then click on save, to save this profile.
This way you don't have to redo all these steps
all at once, over again.
So click on open.
And now it says, okay, you're authenticating
using the EC2 user.
And we have this file we just opened.
And so now we are into our Amazon Linux 2 AMI.
So we have successfully performed the SSH using PuTTY.
Okay.
So if in the course I refer to SSH, just for you,
just that means you should PuTTY into the Instance,
at least once.
And now what I can do, who am I?
And you find that I am EC2 user.
Or ping google.com and start running some commands.
So to stop this,
just do control C, and it will stop the command.
And then if you want to just exit this,
you can just close this, exit this session,
and you're good to go.
And let's check if you go back into PuTTY.
So click back on PuTTY, and you load the EC2 Instance.
Hopefully all you're seeing there is save.
So as you can see, the top settings are saved,
and my SSH Auth also has saved.
And therefore, if I click on open, then yes,
I have access directly into my EC2 Instance.
So we've successfully performed SSH
on this Windows 7 or Windows 8, through PuTTY.
And I will see you in the next lecture
in case you have Windows 10,
to show you how to SSH using Windows.