WEBVTT

00:00.940 --> 00:05.080
-In this demo, we will learn
how to provision a Linux EC2-instance

00:05.080 --> 00:07.540
using the AWS Management Console.

00:09.320 --> 00:12.400
From the management console,
to get to the EC to service,

00:12.400 --> 00:15.040
click on the Services tab on the top left.

00:16.360 --> 00:19.940
The EC2 service is located
under the service group for Compute.

00:20.940 --> 00:22.580
Another way to locate the service

00:22.580 --> 00:25.640
is to make use of the service search bar
from the dashboard.

00:26.300 --> 00:30.080
We can also launch it by clicking
on the Launch a virtual machine link

00:30.080 --> 00:31.460
just under the Search bar.

00:33.580 --> 00:35.780
We are now inside the EC2 console.

00:36.780 --> 00:39.260
Please note that we are currently
in the central region,

00:39.260 --> 00:40.260
which is Canada,

00:40.640 --> 00:43.060
and this is where we will be deploying
this instance.

00:43.960 --> 00:45.680
To create an EC2 instance,

00:45.680 --> 00:47.600
click on the Launch instance button.

00:48.880 --> 00:50.780
This will open up the launch wizard.

00:51.300 --> 00:53.840
The first thing to do is to select an AMI,

00:53.840 --> 00:55.620
which is Amazon machine image.

00:56.320 --> 00:58.940
We are going to deploy
a web server on Ubuntu,

00:58.940 --> 01:02.120
so select the AMI for Ubuntu 20.04.

01:03.980 --> 01:07.000
As you can see, this AMI is free tier eligible.

01:07.840 --> 01:09.860
Next, we have to select the instance type,

01:10.440 --> 01:12.240
so let's use t2 micro.

01:13.920 --> 01:16.340
In the next step,
we can configure the instance.

01:16.680 --> 01:19.200
We will leave most
of these to the default values.

01:19.840 --> 01:22.460
For the network,
we will make use of the default VPC,

01:22.580 --> 01:24.780
which is automatically created
for this region.

01:25.400 --> 01:28.120
Think of VPC as an isolated private network

01:28.120 --> 01:31.340
within the AWS infrastructure
where we can deploy services.

01:32.620 --> 01:36.720
Within this VPC, we will also make use
of the default value for the subnet.

01:38.620 --> 01:40.940
Since we want this instance to be a web server,

01:40.940 --> 01:47.080
we'll make use of the user data feature of EC2
to pass in a shell script to install NGINX.

01:49.200 --> 01:52.220
The user data field is
under the Advanced Details.

01:52.980 --> 01:54.620
When ready, click on Next.

01:56.480 --> 01:58.260
This will take us to the storage section,

01:58.620 --> 02:00.500
we will leave this to be default value.

02:02.500 --> 02:05.400
There is a single 8GB GP2 disk,

02:05.400 --> 02:09.680
which is an SSD type disk that will be used
to create the root partition.

02:10.440 --> 02:11.100
Click Next,

02:11.100 --> 02:13.780
and we can now add some tags to our instance.

02:14.460 --> 02:17.700
Let us add a tag called Name
with the value of web server.

02:19.060 --> 02:21.720
Next, we can configure security group
for this instance,

02:22.520 --> 02:24.880
we should be able to SSH to this machine.

02:24.960 --> 02:27.080
Let's create a new security group,

02:27.080 --> 02:29.000
and let's call it SSH Access.

02:29.680 --> 02:32.080
Let's also add a proper description
for this group.

02:34.980 --> 02:37.180
Under the Type, you'll find a drop-down

02:37.180 --> 02:39.440
with several different types
of firewall rules,

02:39.560 --> 02:43.340
but we are only interested in
an inbound rule that will allow SSH access,

02:43.940 --> 02:45.840
so leave the default value as it is.

02:47.160 --> 02:51.160
Since the source is set to 0.0.0.0/0,

02:51.160 --> 02:55.120
this will mean that the SSH connection
is open from the entire world.

02:55.540 --> 02:58.300
While this is not a recommended setting
for a production server,

02:58.300 --> 02:59.580
it will do for this demo.

03:00.580 --> 03:02.720
Next,
we can review the instance configuration.

03:03.320 --> 03:05.360
Once you're happy with it, click on Launch.

03:06.820 --> 03:08.060
As soon as we click it,

03:08.180 --> 03:11.280
we will get a pop-up notification to use
an existing key pair

03:11.280 --> 03:12.940
or to create a new key pair.

03:14.100 --> 03:17.060
Since we do not have a key pair
created in this region yet,

03:17.520 --> 03:19.060
we will want to create a new one.

03:20.320 --> 03:22.620
Let's call it Web, and once that's created,

03:22.620 --> 03:24.040
download it to the machine.

03:25.960 --> 03:28.880
This will be later used as
an authentication mechanism

03:28.880 --> 03:30.520
to SSH to our instance.

03:32.100 --> 03:33.920
Next, click on Launch instance.

03:35.400 --> 03:37.780
This can take a few minutes,
so please be patient.

03:39.320 --> 03:43.040
Click on View instances
to check the status of this EC2 instance.

03:48.980 --> 03:53.080
We have one EC2 instance
called Webserver which is in a running state.

03:53.560 --> 03:57.300
Click on it and we should be able to see
all the details about this instance.

03:58.600 --> 04:01.140
In the Details section,
we can see the public IP

04:01.240 --> 04:02.620
created for this instance.

04:02.860 --> 04:04.700
Let's copy it into the clipboard.

04:05.300 --> 04:07.640
We can also see information such as the VPC,

04:07.640 --> 04:12.020
subnet, the instance type, and the AMI ID
that's used for creating this instance.

04:14.520 --> 04:17.740
In the Security tab, we can see
the security group that we created.

04:18.740 --> 04:19.800
Under the Networking tab,

04:19.800 --> 04:24.460
we can see public IPv4 address
as well as the private IPv4 address

04:24.460 --> 04:25.960
which is created for this instance.

04:27.360 --> 04:31.200
Under the Storage tab, we can see
the EBS volume that is used by this instance.

04:33.700 --> 04:37.080
Now, let us use SSH to get to this instance
from the terminal.

04:38.900 --> 04:42.000
Here I am inside the terminal
of my local machine.

04:42.520 --> 04:45.680
To SSH into the instance
we will use the SSH command

04:45.840 --> 04:49.560
and pass in the private key called Web
that we downloaded from the console.

04:50.260 --> 04:52.120
The user for this instance is Ubuntu,

04:52.120 --> 04:55.460
and we'll make use of the public IP
that we copied from the console.

04:58.200 --> 04:59.620
The first time you run this command,

04:59.740 --> 05:01.560
you may run into an error like this.

05:02.140 --> 05:04.560
This is because the private key file is open

05:04.560 --> 05:06.280
and does not have the correct permissions.

05:07.360 --> 05:09.660
To fix this, use the chmod command

05:09.660 --> 05:14.020
and change the permission to 400
keeping only read permission for the owner.

05:19.440 --> 05:22.880
If we run the command again,
we should be able to SSH into the instance.

05:24.820 --> 05:28.380
Finally, let's see if NGNIX was installed
and started on the server.

05:28.880 --> 05:32.560
To do this,
let's run the command system CTL status NGNIX.

05:33.600 --> 05:36.880
As you can see, NGNIX was installed
and it is in a running state.

05:38.280 --> 05:40.140
That was a quick demonstration video

05:40.140 --> 05:42.980
to show you how to launch
an Ubuntu EC2 machine

05:42.980 --> 05:44.820
using the AWS Management Console

05:45.200 --> 05:50.280
and to install enable and start NGNIX on it
using the user-data feature of EC2.

