1 00:00:00,700 --> 00:00:01,590 ‫Now let's talk about 2 00:00:01,590 --> 00:00:03,760 ‫how do you update an ECS service. 3 00:00:03,760 --> 00:00:05,520 ‫And for this we have rolling updates. 4 00:00:05,520 --> 00:00:08,640 ‫So when you update an ECS service from v1 to v2, 5 00:00:08,640 --> 00:00:10,870 ‫you can control how many tasks will be started 6 00:00:10,870 --> 00:00:13,330 ‫and stopped at a time and in which order. 7 00:00:13,330 --> 00:00:15,690 ‫So when you have an ECS updates, 8 00:00:15,690 --> 00:00:18,340 ‫when you select a new task definition number 9 00:00:18,340 --> 00:00:20,240 ‫and you want to update an ECS service, 10 00:00:20,240 --> 00:00:21,650 ‫you will have two settings, 11 00:00:21,650 --> 00:00:25,520 ‫the minimum healthy percent and the maximum percent. 12 00:00:25,520 --> 00:00:27,710 ‫So by default they're one and 200 13 00:00:27,710 --> 00:00:29,030 ‫but let's see what they mean. 14 00:00:29,030 --> 00:00:30,570 ‫So your ECS service, 15 00:00:30,570 --> 00:00:31,403 ‫for example, this one is running nine tasks 16 00:00:31,403 --> 00:00:36,403 ‫represents an actual running capacity of 100%. 17 00:00:37,130 --> 00:00:39,690 ‫And then if you set a minimum healthy percent 18 00:00:39,690 --> 00:00:42,177 ‫of less than 100, this is going to say, 19 00:00:42,177 --> 00:00:44,650 ‫"Hey you're allowed to terminate all the tasks 20 00:00:44,650 --> 00:00:47,880 ‫on the right hand side, as long as we have enough tasks 21 00:00:47,880 --> 00:00:51,980 ‫to have a percentage over the minimum healthy percent." 22 00:00:51,980 --> 00:00:55,400 ‫And in the maximum percent shows you how many new tasks 23 00:00:55,400 --> 00:00:57,920 ‫you can create of the version two, 24 00:00:57,920 --> 00:01:01,460 ‫to basically roll updates your service. 25 00:01:01,460 --> 00:01:04,700 ‫So this is how these two settings would impact your updates. 26 00:01:04,700 --> 00:01:07,410 ‫And so you will go ahead, create new tasks, 27 00:01:07,410 --> 00:01:09,498 ‫then terminate all tasks and so on. 28 00:01:09,498 --> 00:01:11,860 ‫All to make sure that all your tasks 29 00:01:11,860 --> 00:01:13,210 ‫are going to be terminated 30 00:01:13,210 --> 00:01:15,630 ‫and then updated to a newer version. 31 00:01:15,630 --> 00:01:17,350 ‫So let's discuss two scenarios. 32 00:01:17,350 --> 00:01:19,730 ‫For example, we have min at 50% 33 00:01:19,730 --> 00:01:23,310 ‫and max at 100% and we start with four tasks. 34 00:01:23,310 --> 00:01:24,210 ‫In this case, 35 00:01:24,210 --> 00:01:26,980 ‫we're going to lose four tasks to be terminated 36 00:01:26,980 --> 00:01:29,900 ‫so that we're running at 50% capacity. 37 00:01:29,900 --> 00:01:34,100 ‫Then two new tasks are going to be created, okay? 38 00:01:34,100 --> 00:01:36,690 ‫Now we're back at 100% capacity. 39 00:01:36,690 --> 00:01:39,120 ‫Then two old tasks are going to be terminated, 40 00:01:39,120 --> 00:01:41,120 ‫we're back at 50% capacity. 41 00:01:41,120 --> 00:01:43,500 ‫And two new tasks are going to be created, 42 00:01:43,500 --> 00:01:45,620 ‫we're back at 100 capacity. 43 00:01:45,620 --> 00:01:47,610 ‫And we have done a rolling updates. 44 00:01:47,610 --> 00:01:49,940 ‫In this case, we have been terminating tasks 45 00:01:49,940 --> 00:01:52,180 ‫because we set the minimum to 50% 46 00:01:52,180 --> 00:01:54,510 ‫and the maximum to 100%. 47 00:01:54,510 --> 00:01:59,210 ‫If we're doing minimum at 100% and maximum at 150% 48 00:01:59,210 --> 00:02:00,700 ‫then we start with four tasks. 49 00:02:00,700 --> 00:02:03,850 ‫We cannot determine a task because the minimum is 100%. 50 00:02:03,850 --> 00:02:06,740 ‫Therefore we can go into create two new tasks 51 00:02:06,740 --> 00:02:09,980 ‫and this will bring our capacity to 150%. 52 00:02:09,980 --> 00:02:12,760 ‫Then because we are above the minimum 100% 53 00:02:12,760 --> 00:02:16,460 ‫we can terminate two old task and we're back at 100%. 54 00:02:16,460 --> 00:02:18,020 ‫Then we will create two new tasks 55 00:02:18,020 --> 00:02:20,017 ‫and finally, terminates two old tasks. 56 00:02:20,017 --> 00:02:22,680 ‫And this will have performed our rolling updates 57 00:02:22,680 --> 00:02:24,420 ‫for our ECS service. 58 00:02:24,420 --> 00:02:25,680 ‫So just something you should know, 59 00:02:25,680 --> 00:02:27,800 ‫if you read lecture going into the exam 60 00:02:27,800 --> 00:02:30,320 ‫this could be happening at one question only. 61 00:02:30,320 --> 00:02:31,153 ‫All right, that's it. 62 00:02:31,153 --> 00:02:32,880 ‫I will see you in the next lecture.