1 00:00:00,180 --> 00:00:02,670 ‫So now let's talk about a very handy feature 2 00:00:02,670 --> 00:00:06,240 ‫of Auto Scaling groups called Instance Refresh. 3 00:00:06,240 --> 00:00:08,310 ‫So the idea is that you want to update 4 00:00:08,310 --> 00:00:10,140 ‫an entire Auto Scaling group 5 00:00:10,140 --> 00:00:13,380 ‫thanks to a new launch template that you've created. 6 00:00:13,380 --> 00:00:16,470 ‫And so you wanna re-create all EC2 instances. 7 00:00:16,470 --> 00:00:19,290 ‫For this, you can, instead of terminating an instance 8 00:00:19,290 --> 00:00:20,760 ‫and waiting for it to come back, 9 00:00:20,760 --> 00:00:23,490 ‫you can use the native feature of Auto Scaling groups 10 00:00:23,490 --> 00:00:25,260 ‫called Instance Refresh. 11 00:00:25,260 --> 00:00:26,190 ‫So let's take an example. 12 00:00:26,190 --> 00:00:28,470 ‫Say we have an Auto Scaling group 13 00:00:28,470 --> 00:00:31,170 ‫and the EC2 instances have been launched 14 00:00:31,170 --> 00:00:33,270 ‫with an old launch template. 15 00:00:33,270 --> 00:00:36,390 ‫I say old because we are creating a new launch template. 16 00:00:36,390 --> 00:00:39,420 ‫For example, we updated the underlying AMI 17 00:00:39,420 --> 00:00:41,250 ‫of our EC2 instances, 18 00:00:41,250 --> 00:00:42,930 ‫and then we're going to the API call 19 00:00:42,930 --> 00:00:45,750 ‫named Start Instance Refresh. 20 00:00:45,750 --> 00:00:46,830 ‫So what's going to happen is 21 00:00:46,830 --> 00:00:49,440 ‫that we're going to set a minimum healthy percentage, 22 00:00:49,440 --> 00:00:51,360 ‫for example, 60%, 23 00:00:51,360 --> 00:00:53,730 ‫and that tells our Auto Scaling group 24 00:00:53,730 --> 00:00:57,480 ‫how many instances can be deleted over time. 25 00:00:57,480 --> 00:01:00,480 ‫And then as instances are terminated, 26 00:01:00,480 --> 00:01:04,140 ‫then new ones are coming up with the new launch template. 27 00:01:04,140 --> 00:01:06,150 ‫That's why it's called an EC2 Instance Refresh, 28 00:01:06,150 --> 00:01:09,060 ‫is because instances are being terminated 29 00:01:09,060 --> 00:01:10,680 ‫and new ones come up. 30 00:01:10,680 --> 00:01:14,670 ‫And over time, all instances having the old launch template 31 00:01:14,670 --> 00:01:17,640 ‫will be terminated and the new ones will come up. 32 00:01:17,640 --> 00:01:20,130 ‫So on top of it, to make sure that your EC2 instances 33 00:01:20,130 --> 00:01:23,100 ‫have enough time to be ready and to serve traffic, 34 00:01:23,100 --> 00:01:24,990 ‫you can specify a warm-up time, 35 00:01:24,990 --> 00:01:28,170 ‫which is to say how long to wait until we can assume 36 00:01:28,170 --> 00:01:31,380 ‫that the new EC2 instance is ready to use. 37 00:01:31,380 --> 00:01:33,060 ‫Okay? So that's it for this lecture. 38 00:01:33,060 --> 00:01:36,303 ‫I hope you liked it and I will see you in the next lecture.