1 00:00:00,210 --> 00:00:02,190 ‫So Beanstalk can store, at most, 2 00:00:02,190 --> 00:00:06,210 ‫1000 application versions inside of your account. 3 00:00:06,210 --> 00:00:07,830 ‫And so if you don't remove old versions, 4 00:00:07,830 --> 00:00:08,663 ‫you will not be able 5 00:00:08,663 --> 00:00:10,980 ‫to deploy your Beanstalk applications anymore. 6 00:00:10,980 --> 00:00:12,030 ‫And so what you need to do 7 00:00:12,030 --> 00:00:14,160 ‫is to phase out old application versions 8 00:00:14,160 --> 00:00:18,450 ‫and to do so you can use a Beanstalk lifecycle policy. 9 00:00:18,450 --> 00:00:20,520 ‫This lifecycle policy will send hands-on, 10 00:00:20,520 --> 00:00:23,730 ‫can be based on time to remove older versions 11 00:00:23,730 --> 00:00:25,440 ‫or it can be based on space 12 00:00:25,440 --> 00:00:26,550 ‫when you have too many versions 13 00:00:26,550 --> 00:00:28,530 ‫you just phase out the old ones. 14 00:00:28,530 --> 00:00:30,570 ‫The versions obviously, that are currently used 15 00:00:30,570 --> 00:00:32,910 ‫by your environments will not be deleted, 16 00:00:32,910 --> 00:00:35,850 ‫even though they're old or are using too much space. 17 00:00:35,850 --> 00:00:39,300 ‫And you also have the option not to delete the source bundle 18 00:00:39,300 --> 00:00:41,280 ‫of your application in Amazon S3, 19 00:00:41,280 --> 00:00:43,050 ‫in order to prevent data loss 20 00:00:43,050 --> 00:00:45,484 ‫which can be very helpful if you want to prevent 21 00:00:45,484 --> 00:00:47,640 ‫and you want to restore these versions later on. 22 00:00:47,640 --> 00:00:50,340 ‫Right now, the lifecycle policy just can just remove them 23 00:00:50,340 --> 00:00:51,990 ‫from the Beanstalk interface. 24 00:00:51,990 --> 00:00:55,140 ‫So let's go in the hands-on to see how this works. 25 00:00:55,140 --> 00:00:58,050 ‫So now we're going to demo lifecycle policy. 26 00:00:58,050 --> 00:01:02,280 ‫So I go to application versions under MyApplication 27 00:01:02,280 --> 00:01:05,100 ‫and we can find the MyApplication-blue 28 00:01:05,100 --> 00:01:07,290 ‫that we deployed before, 29 00:01:07,290 --> 00:01:09,990 ‫and we know that which label is deployed 30 00:01:09,990 --> 00:01:12,690 ‫from which source and to which location. 31 00:01:12,690 --> 00:01:14,340 ‫So first let's have a look at the source. 32 00:01:14,340 --> 00:01:17,430 ‫If I click on source, this is actually going to download it. 33 00:01:17,430 --> 00:01:19,140 ‫So I'm going to go instead 34 00:01:19,140 --> 00:01:22,500 ‫into Amazon S3 and show you what this is about. 35 00:01:22,500 --> 00:01:25,710 ‫So I am in S3 right here 36 00:01:25,710 --> 00:01:28,373 ‫and I'm going to type Beanstalk and go to the region. 37 00:01:28,373 --> 00:01:30,660 ‫I'm in EU Central-1. 38 00:01:30,660 --> 00:01:33,360 ‫And as we can see, this bucket was created 39 00:01:33,360 --> 00:01:36,330 ‫by Beanstalk to hold all my application versions 40 00:01:36,330 --> 00:01:37,350 ‫for my applications. 41 00:01:37,350 --> 00:01:40,090 ‫And so this blue version has been uploaded 42 00:01:41,184 --> 00:01:42,017 ‫to Beanstock right here 43 00:01:42,017 --> 00:01:44,400 ‫and so all the application versions are going to remain 44 00:01:44,400 --> 00:01:45,750 ‫in Amazon S3. 45 00:01:45,750 --> 00:01:47,280 ‫But they're going to be registered 46 00:01:47,280 --> 00:01:51,060 ‫in Beanstalk and we can control how many of them they are. 47 00:01:51,060 --> 00:01:52,800 ‫So if you go into settings, 48 00:01:52,800 --> 00:01:56,820 ‫you can activate a application lifecycle policy 49 00:01:56,820 --> 00:01:58,080 ‫and if you activate it, 50 00:01:58,080 --> 00:02:01,440 ‫you can either limit the application versions by counts 51 00:02:01,440 --> 00:02:05,130 ‫and saying you want a maximum of 200 application versions 52 00:02:05,130 --> 00:02:09,810 ‫or you can limit it by age and say, I only want the 180 days 53 00:02:09,810 --> 00:02:13,680 ‫of versions that have been used. 54 00:02:13,680 --> 00:02:16,800 ‫Of course, if your version is actually used, 55 00:02:16,800 --> 00:02:18,330 ‫it's not going to be deleted. 56 00:02:18,330 --> 00:02:20,970 ‫But if it's not used, and not compliant 57 00:02:20,970 --> 00:02:22,920 ‫with this lifecycle rule, it will be deleted. 58 00:02:22,920 --> 00:02:24,930 ‫Now, it will be deleted from Beanstalk, 59 00:02:24,930 --> 00:02:27,240 ‫but what happens to it in Amazon S3? 60 00:02:27,240 --> 00:02:28,290 ‫Well, we have two options, 61 00:02:28,290 --> 00:02:30,780 ‫either we retain the source bundle in Amazon S3, 62 00:02:30,780 --> 00:02:33,270 ‫which is good for if you wanted to do some kind 63 00:02:33,270 --> 00:02:36,600 ‫of recovery or delete the source bundle from S3. 64 00:02:36,600 --> 00:02:40,050 ‫And finally, what role allows you to perform this deletion? 65 00:02:40,050 --> 00:02:43,860 ‫And so here we have the AWS Elastic Beanstalk service role. 66 00:02:43,860 --> 00:02:45,090 ‫So that's it for this lecture. 67 00:02:45,090 --> 00:02:46,800 ‫We've seen lifecycle policies 68 00:02:46,800 --> 00:02:50,340 ‫and the backing S3 bucket of Elastic Beanstalk. 69 00:02:50,340 --> 00:02:53,433 ‫I hope you liked it and I will see you in the next lecture.