And this starts a wizard
where we can configure this to be launched instance,
so this to be launched cloud server.
And here you should choose this Amazon Linux AMI,
this will basically be the operating system,
which is installed on the server,
and there this first choice in the 64 bit version here
x86 should be the version you choose,
and simply click Select there for it.
Next, make sure you choose a free tier eligible option here,
in my case, the t2 micro instance.
Generally on this screen,
you can choose which kind of instance you want to launch,
and there are a lot of instances,
from very small ones, which are not very powerful,
which have only limited memory and CPUs,
all the way up to very powerful instances,
which can be used for compute intensive work,
but obviously these more powerful instances
will be way more expensive and therefore, for this demo,
we're going to use the T2 micro one,
which is not very powerful,
but which we can get started with for free.
So then click on Next: Configure Instance Details
and make sure that a VPC is created on here,
that a default VPC is selected on here.
If that's not the case, click create new VPC
and leave all the other default settings as they are.
You don't need to configure anything else here,
unless you know what you're doing.
So next, you can click Review and Launch already,
and you should be on this screen
where you can review your setup,
and all the defaults should be fine here.
Verify that you used t2 micro, and then click Launch,
and this will bring up this screen.
This is an important screen.
Here you can create a new key pair
and you will need this key pair,
which will be a file in the end,
to later connect to your instance via SSH
and to run commands on it.
So choose create a new key pair here
and then give it any name of your choice,
in my case example-1,
and then click Download Key Pair,
and that's very important.
You'll only be able to download this once
and you need this to connect,
so if you lose this key,
you will have to shut down your instance and start a new one
because you'll not be able to connect to it anymore.
So I downloaded and saved this key file
into my project folder here, though I will say,
you should not share this key file with anyone
because everyone who has this file will be able
to connect to your launched remote machine here,
so store it somewhere where only you have access to it.
And once you did that click Launch Instances,
and this will now launch this demo virtual instance,
so this demo cloud-based computer.
Click View Instances thereafter,
and then let's wait until this is up and running,
which can take a couple of minutes of course.
So now my instance is up and running here,
and as I said, we're going to connect via SSH.
SSH stands for Secure Shell,
and in the end, it's a protocol
for connecting to a remote machine from your local machine
via the command line or terminal you have
on your local machine.
Now, on Linux and Mac iOS devices,
this is super simple because there,
you will be able to use the regular terminal
and you already have a SSH command there,
which you can use to establish such a SSH connection
to a remote server.
On Windows, this is not built-in.
On Windows, you either need to set up WSL 2 on Windows 10,
which in the end is Linux running on your Windows machine,
and you can look into the official Microsoft Documentation
on how to do that,
or you use a tool like PuTTY,
which you can simply download and install
on your Windows machine to then use that
to run SSH commands because PuTTY is a SSH client.
Once you got it installed, you will get a command prompt,
you could say, built into PuTTY,
which you then can use to run SSH commands.
So you need to do either that or use WSL 2
in order to connect to a remote machine with SSH on Windows.
Now, once you've finished all these preparations
and you ensured that you can run SSH commands,
here's how we can connect to our instance.
We simply click on Connect here in the AWS,
EC2 dashboard, and then choose a standalone SSH client,
and here you then get the detailed steps
you need to execute in order to connect
to your machine here,
your virtual EC2 instance running in the cloud
from your local machine,
and this will be required in step three
in order to install Docker
and run our container on that machine.
But wait, didn't I skip a step here?
What about step two, configuring security groups?
Indeed, that's a step we all should take care of,
but we can also do this
after starting our Docker container on that instance,
the exact order doesn't matter here
and therefore, let's continue with this for now.
So open PuTTY on Windows, or the WSL 2 batch on Windows,
or your regular terminal or batch on macOS or Linux,
and I did this here in my project folder,
where I also have this key file,
and then we need to run this command here first
in order to ensure that this key file can be used.
Important note right away,
if you're on Windows and using PuTTY,
you can skip this step.
This command, the chmod command won't be available
in the regular command prompt on Windows anyways,
and you will also be able
to later skip this command line approach
of running the SSH command if you're using PuTTY on Windows,
because PuTTY gives you a graphical user interface
where you can enter the host address
and point at your key file,
and attached, you'll find a link
with detailed step by step instructions on how to connect
to the EC2 instance via Windows PuTTY.
That's just one important side note.
What I'm showing here will work
if you're using WSL 2 on Windows,
or if you're using the batch on Linux
or the terminal on macOS.
So paste in this command and execute it
to ensure that this key file has the right permissions
in order to continue.
Now, once you did that, we can continue with the next step,
which in the end, is copying this command here,
which you find down there,
and then simply executing it here.
Make sure you're running this in the same folder
as your permissions file lives in.
Hit Enter and then type yes here
when you're getting this question,
whether you want to connect or not,
and thereafter you should be connected,
and you can tell by the fact that it's saying something like
ec2-user@, and then some IP address.
Now, all the commands you execute here
in this terminal window
will be executed on the remote machine,
so not on your local machine anymore,
but on the remote machine.
And now here, we need to install Docker
and then somehow get our image,
which we build locally onto that remote machine,
and then we need to run a container,
configure the security groups and we'll be done.
So let's go for these steps next.