1 00:00:06,656 --> 00:00:08,315 - Let's take a look at another demo 2 00:00:08,315 --> 00:00:12,482 of adding a lifecycle rules to an existing S3 bucket. 3 00:00:13,498 --> 00:00:15,957 Here we are in the console. 4 00:00:15,957 --> 00:00:19,556 We are in the S3 service taking a look 5 00:00:19,556 --> 00:00:23,723 at the AWS live lessons bucket that we've created earlier. 6 00:00:25,908 --> 00:00:29,206 And here we want to add a lifecycle rule to that bucket 7 00:00:29,206 --> 00:00:33,581 so that we can automatically transition objects 8 00:00:33,581 --> 00:00:37,547 from S3 to Glacier after a period of time. 9 00:00:37,547 --> 00:00:39,947 Now for these series of demos, 10 00:00:39,947 --> 00:00:41,582 we're just gonna use this one bucket, 11 00:00:41,582 --> 00:00:43,573 and we can use prefixes to do that. 12 00:00:43,573 --> 00:00:46,482 So I'm gonna leverage the magic of the UI here 13 00:00:46,482 --> 00:00:49,106 to create what appears to be a folder. 14 00:00:49,106 --> 00:00:51,981 I'm gonna call this logs. 15 00:00:51,981 --> 00:00:54,438 Now you'll see here there's nothing in there yet, 16 00:00:54,438 --> 00:00:58,696 but perhaps later I might use an applications hosted 17 00:00:58,696 --> 00:01:02,363 in Amazon EC2 to write their log files to S3 18 00:01:04,227 --> 00:01:07,071 and then keep them for some period of time 19 00:01:07,071 --> 00:01:10,895 before they are archived into Glacier. 20 00:01:10,895 --> 00:01:14,571 So I'm gonna go over here, to go back to the bucket itself, 21 00:01:14,571 --> 00:01:17,189 I'm gonna go to properties. 22 00:01:17,189 --> 00:01:21,356 I'm going to scroll down here to the lifecycle section, 23 00:01:24,640 --> 00:01:27,520 and I'm going to add a rule. 24 00:01:27,520 --> 00:01:30,620 In this particular case, I don't want the entire bucket. 25 00:01:30,620 --> 00:01:32,187 I only want a prefix, 26 00:01:32,187 --> 00:01:35,713 so the prefix that I'm going to use is logs. 27 00:01:35,713 --> 00:01:39,880 So that means everything under the logs quote unquote folder 28 00:01:41,433 --> 00:01:43,766 will be archived to Glacier. 29 00:01:46,414 --> 00:01:48,414 So I'm gonna click next, 30 00:01:49,636 --> 00:01:51,858 and you can see I can use the lifecycle 31 00:01:51,858 --> 00:01:54,280 to change the storage class 32 00:01:54,280 --> 00:01:57,803 to either the infrequent access storage 33 00:01:57,803 --> 00:02:01,663 or archive it to Glacier or permanently delete. 34 00:02:01,663 --> 00:02:04,633 So one common use case is for some kind 35 00:02:04,633 --> 00:02:08,868 of regulatory compliance, be it Sarbanes-Oxley or PCI 36 00:02:08,868 --> 00:02:11,197 or, you know, whatever it may be, 37 00:02:11,197 --> 00:02:12,936 we want to keep these for some period of time. 38 00:02:12,936 --> 00:02:15,077 So I'm gonna archive to Glacier 39 00:02:15,077 --> 00:02:18,318 let's say seven days, so I'm gonna keep them for a week 40 00:02:18,318 --> 00:02:21,330 in case I wanna do some kind of computing with them, 41 00:02:21,330 --> 00:02:25,497 batch processing, and then I want to permanently delete them 42 00:02:27,659 --> 00:02:31,497 after about seven years, so 2600 days. 43 00:02:31,497 --> 00:02:33,497 So you can see here that 44 00:02:34,849 --> 00:02:38,023 if I were to upload something today, 45 00:02:38,023 --> 00:02:41,323 then one week from now on November 10th, 46 00:02:41,323 --> 00:02:43,018 it would archive to Glacier, 47 00:02:43,018 --> 00:02:46,866 and then somewhere around seven years from now, 48 00:02:46,866 --> 00:02:49,548 they would be deleted from Glacier. 49 00:02:49,548 --> 00:02:52,260 So I'm gonna go ahead and hit review. 50 00:02:52,260 --> 00:02:55,343 I'm gonna call this one archive logs, 51 00:03:00,514 --> 00:03:02,333 and you can see here it says "This will apply 52 00:03:02,333 --> 00:03:05,508 to objects with the prefix logs slash 53 00:03:05,508 --> 00:03:08,175 in the AWS live lessons bucket." 54 00:03:09,114 --> 00:03:11,205 It will archive to Glacier seven days 55 00:03:11,205 --> 00:03:14,317 after the creation date and permanently delete 56 00:03:14,317 --> 00:03:17,631 2600 days after the creation date. 57 00:03:17,631 --> 00:03:22,015 So I'm gonna go ahead and create and activate that rule, 58 00:03:22,015 --> 00:03:22,848 and there we go. 59 00:03:22,848 --> 00:03:25,629 We can see that we have a lifecycle rule in place 60 00:03:25,629 --> 00:03:29,408 for anything that goes into the logs folder, 61 00:03:29,408 --> 00:03:32,190 and that is how we add a lifecycle rule 62 00:03:32,190 --> 00:03:34,107 to an Amazon S3 bucket.