1
00:00:02,240 --> 00:00:05,740
So how could we now update our container here?

2
00:00:05,740 --> 00:00:09,040
Let's say in our source code,

3
00:00:09,040 --> 00:00:12,290
I revert all my extra exclamation marks

4
00:00:12,290 --> 00:00:16,100
and I go back to just one exclamation Mark.

5
00:00:16,100 --> 00:00:18,140
Now with the updated code,

6
00:00:18,140 --> 00:00:19,550
run Docker build again

7
00:00:19,550 --> 00:00:20,793
to build that image,

8
00:00:21,670 --> 00:00:22,503
once you did that

9
00:00:22,503 --> 00:00:25,090
make sure you also tag it again

10
00:00:25,090 --> 00:00:27,730
to replace that repository image

11
00:00:27,730 --> 00:00:30,660
with your locally updated image, so to say.

12
00:00:30,660 --> 00:00:33,540
We could have also just used that name right away

13
00:00:33,540 --> 00:00:35,020
when we built the image.

14
00:00:35,020 --> 00:00:37,510
I just like this double image strategy,

15
00:00:37,510 --> 00:00:40,160
but that's my own personal preference.

16
00:00:40,160 --> 00:00:44,560
And then push this updated image to Docker Hub,

17
00:00:44,560 --> 00:00:47,683
so that this latest image is reflected there.

18
00:00:48,520 --> 00:00:50,240
Now the question just is,

19
00:00:50,240 --> 00:00:55,210
how we make AWS ECS aware of this updated image.

20
00:00:55,210 --> 00:00:57,480
It's not going to use it automatically,

21
00:00:57,480 --> 00:00:58,470
and that's a good thing.

22
00:00:58,470 --> 00:00:59,590
It would be kind of bad

23
00:00:59,590 --> 00:01:02,220
if it magically updates behind the scenes.

24
00:01:02,220 --> 00:01:04,250
Instead, we have to tell it

25
00:01:04,250 --> 00:01:08,470
and you can do so by going to your clusters, default

26
00:01:08,470 --> 00:01:11,460
and then there to your tasks

27
00:01:11,460 --> 00:01:14,210
and click on your task definition of the task,

28
00:01:14,210 --> 00:01:15,970
which is running here.

29
00:01:15,970 --> 00:01:18,870
Now choose create new revision

30
00:01:18,870 --> 00:01:20,840
which allows you to create a new task,

31
00:01:20,840 --> 00:01:24,420
but keep all the settings you already have there.

32
00:01:24,420 --> 00:01:27,230
So I just wanna create the same task again,

33
00:01:27,230 --> 00:01:31,020
because then AWS ECS will automatically pull

34
00:01:31,020 --> 00:01:32,330
the updated image.

35
00:01:32,330 --> 00:01:34,170
When you create a new task

36
00:01:34,170 --> 00:01:36,440
and then launch and use service in that task.

37
00:01:36,440 --> 00:01:40,660
AWS will use the latest image version.

38
00:01:40,660 --> 00:01:43,620
So, I'll create a new task revision

39
00:01:43,620 --> 00:01:46,910
based on the same settings as before.

40
00:01:46,910 --> 00:01:49,610
Now, once this task was updated

41
00:01:49,610 --> 00:01:51,880
and you're on this confirmation page,

42
00:01:51,880 --> 00:01:55,070
click on actions, update service,

43
00:01:55,070 --> 00:01:57,403
keep all the settings here as well.

44
00:01:58,670 --> 00:02:00,780
Click on skip to review

45
00:02:00,780 --> 00:02:03,170
and click on update service here.

46
00:02:03,170 --> 00:02:06,200
And this will now really pull in that latest image

47
00:02:06,200 --> 00:02:10,070
and then restart this service in this task.

48
00:02:10,070 --> 00:02:14,570
So if we now view this service, under tasks here

49
00:02:14,570 --> 00:02:16,880
you will see all the tasks

50
00:02:16,880 --> 00:02:18,910
and you'll see this new task revision

51
00:02:18,910 --> 00:02:21,240
which is still provisioning here

52
00:02:21,240 --> 00:02:24,640
which means it's still downloading the images on.

53
00:02:24,640 --> 00:02:26,993
So let's wait for this to finish.

54
00:02:28,140 --> 00:02:31,810
Now it's pending and now it's running

55
00:02:31,810 --> 00:02:34,370
and then click on this task definition

56
00:02:34,370 --> 00:02:36,890
and take this public IP.

57
00:02:36,890 --> 00:02:39,220
And you'll see this application,

58
00:02:39,220 --> 00:02:41,877
this updated application, there now.

59
00:02:41,877 --> 00:02:43,500
Now you might have noticed

60
00:02:43,500 --> 00:02:46,830
that the public IP is a different one than before.

61
00:02:46,830 --> 00:02:47,810
This is true.

62
00:02:47,810 --> 00:02:50,640
AWS will create and assign a new one

63
00:02:50,640 --> 00:02:53,330
for every new task you are launching,

64
00:02:53,330 --> 00:02:56,000
every new task revision you're launching.

65
00:02:56,000 --> 00:02:59,950
But there are ways of actually still connecting a domain

66
00:02:59,950 --> 00:03:03,800
to this running ECS task in general,

67
00:03:03,800 --> 00:03:07,600
independent from the specific IP AWS assigned,

68
00:03:07,600 --> 00:03:09,170
more on that can be found

69
00:03:09,170 --> 00:03:12,240
in the resources attached to this lecture.

70
00:03:12,240 --> 00:03:15,640
But that's now how we started our container

71
00:03:15,640 --> 00:03:20,090
in AWS ECS or with help of AWS ECS,

72
00:03:20,090 --> 00:03:21,250
how we can update it

73
00:03:21,250 --> 00:03:24,050
and how we can now use this managed environment

74
00:03:24,050 --> 00:03:26,473
to run our container in the cloud.

