1
00:00:02,270 --> 00:00:04,150
So that's the first example.

2
00:00:04,150 --> 00:00:07,070
Deploying a basic Node application

3
00:00:07,070 --> 00:00:11,970
without any database or anything else to AWS EC2.

4
00:00:11,970 --> 00:00:14,920
And as I explained in the last lecture already,

5
00:00:14,920 --> 00:00:18,470
EC2 is a service offered by AWS.

6
00:00:18,470 --> 00:00:20,170
Which allows you to spin up your own

7
00:00:20,170 --> 00:00:22,980
remote hosting machines, you could say.

8
00:00:22,980 --> 00:00:25,100
Your own computers in the cloud.

9
00:00:25,100 --> 00:00:27,710
And you will be able to connect to these computers,

10
00:00:27,710 --> 00:00:31,210
to then install any software of your choice on them.

11
00:00:31,210 --> 00:00:33,130
In our case, we'll install Docker

12
00:00:33,130 --> 00:00:35,393
and use that on these servers then.

13
00:00:36,380 --> 00:00:39,750
So, that's what EC2 is and I will use it.

14
00:00:39,750 --> 00:00:43,780
And we will go though three main steps to bring

15
00:00:43,780 --> 00:00:47,863
our Dockerized application to life on an EC2 instance.

16
00:00:48,780 --> 00:00:51,350
The first step, will be that we create

17
00:00:51,350 --> 00:00:55,090
and launch this EC2 instance so this remote computer.

18
00:00:55,090 --> 00:00:58,490
And we also need to create a so called VPC,

19
00:00:58,490 --> 00:01:02,130
a virtual public cloud and a security group,

20
00:01:02,130 --> 00:01:04,860
to control who has access to this instance.

21
00:01:04,860 --> 00:01:06,480
And I'll show you how that works

22
00:01:06,480 --> 00:01:08,480
throughout the next minutes, no worries.

23
00:01:09,440 --> 00:01:12,550
We'll then have to configure that security group,

24
00:01:12,550 --> 00:01:16,250
to expose all required ports to the world wide web,

25
00:01:16,250 --> 00:01:20,623
so that we can have incoming traffic to this EC2 instance.

26
00:01:21,670 --> 00:01:24,890
And we then need to connect to this instance,

27
00:01:24,890 --> 00:01:28,790
via SSH, which stands for secure shell.

28
00:01:28,790 --> 00:01:33,070
Which is a process where a certain approach for connecting

29
00:01:33,070 --> 00:01:34,540
to this remote machine,

30
00:01:34,540 --> 00:01:37,290
a terminal based approach, I should say.

31
00:01:37,290 --> 00:01:41,000
Which then allows us to run commands on that remote computer

32
00:01:41,000 --> 00:01:43,900
and we will run a command to install Docker,

33
00:01:43,900 --> 00:01:47,390
and then pull and run our container.

34
00:01:47,390 --> 00:01:50,910
That's what we're going to do on AWS

35
00:01:50,910 --> 00:01:52,930
or with help of AWS,

36
00:01:52,930 --> 00:01:55,883
to bring our Dockerized application to life.

37
00:01:56,950 --> 00:02:01,630
Now for that, we first of all need a Dockerized application.

38
00:02:01,630 --> 00:02:04,500
And therefore attached you find this very simple

39
00:02:04,500 --> 00:02:07,680
dummy application, which is a Node application

40
00:02:07,680 --> 00:02:12,680
which serves one HTML file this welcome HTML file,

41
00:02:12,870 --> 00:02:17,830
for incoming requests and which then listens on port 80.

42
00:02:17,830 --> 00:02:20,810
I already built a Docker file for you.

43
00:02:20,810 --> 00:02:23,130
As you can tell it's not too fancy

44
00:02:23,130 --> 00:02:27,700
it's a standard Docker file nothing spectacular about that.

45
00:02:27,700 --> 00:02:31,220
And now we can of course build an image based on that

46
00:02:31,220 --> 00:02:33,653
and run a container based on that image then.

47
00:02:34,490 --> 00:02:37,700
So for this, locally on our machine

48
00:02:37,700 --> 00:02:40,860
as we did it multiple times through out this course already,

49
00:02:40,860 --> 00:02:44,020
we can build an image with Docker build dot,

50
00:02:44,020 --> 00:02:47,370
in the terminal navigated into this project folder

51
00:02:47,370 --> 00:02:49,560
where we also find the Docker file,

52
00:02:49,560 --> 00:02:52,160
and then all gives this a tag.

53
00:02:52,160 --> 00:02:56,180
For example Node dep example.

54
00:02:56,180 --> 00:02:58,363
For Node deployment example.

55
00:02:59,270 --> 00:03:02,180
If I now had entered this image gets created.

56
00:03:02,180 --> 00:03:05,740
I'm using the alpine version of the Node image by the way.

57
00:03:05,740 --> 00:03:08,030
Simply since that's a bit slimmer,

58
00:03:08,030 --> 00:03:11,420
to keep the size small and speed this whole build

59
00:03:11,420 --> 00:03:13,613
and deployment process up a bit.

60
00:03:14,600 --> 00:03:17,890
And once this is done, once this image is built,

61
00:03:17,890 --> 00:03:20,780
we can of course run a container based on

62
00:03:20,780 --> 00:03:23,590
that Node dep example image which we just built.

63
00:03:23,590 --> 00:03:27,770
In detach mode, remove it automatically if it shuts down.

64
00:03:27,770 --> 00:03:32,770
Maybe give it a name of Node dep, whatever you want.

65
00:03:33,020 --> 00:03:36,530
And of course also expose port 80

66
00:03:36,530 --> 00:03:38,700
to our local hosting machine,

67
00:03:38,700 --> 00:03:41,603
so that we can test this in the browser here.

68
00:03:42,640 --> 00:03:45,660
We don't need any volumes or networks here

69
00:03:45,660 --> 00:03:47,220
for this basic container.

70
00:03:47,220 --> 00:03:49,270
And therefore that should be all we need.

71
00:03:49,270 --> 00:03:52,330
Hit enter and start this container.

72
00:03:52,330 --> 00:03:55,370
And if you then visit just local host like this,

73
00:03:55,370 --> 00:03:57,860
you should see this screen here.

74
00:03:57,860 --> 00:03:59,883
And this is this demo application.

