1 00:00:00,080 --> 00:00:02,140 So you can transition objects 2 00:00:02,140 --> 00:00:03,140 between storage classes 3 00:00:03,140 --> 00:00:05,030 as we've seen in the previous hands-on. 4 00:00:05,030 --> 00:00:07,000 So we can do it in what way? 5 00:00:07,000 --> 00:00:09,210 Well there is a giant graph on the AWS website 6 00:00:09,210 --> 00:00:10,890 that describes how to do it. 7 00:00:10,890 --> 00:00:12,160 So it's pretty complicated. 8 00:00:12,160 --> 00:00:14,080 But as you can see from STANDARD_IA, 9 00:00:14,080 --> 00:00:16,370 you can go to INTELLIGENT-TIERING, ONEZONE_IA 10 00:00:16,370 --> 00:00:17,980 and then GLACIER, DEEP_ARCHIVE, 11 00:00:17,980 --> 00:00:20,150 and it just shows the possible transitions. 12 00:00:20,150 --> 00:00:21,540 As you can see from GLACIER, 13 00:00:21,540 --> 00:00:23,060 you cannot go back to STANDARD_IA. 14 00:00:23,060 --> 00:00:24,310 You have to restore the objects 15 00:00:24,310 --> 00:00:26,420 and then copy that restored copy into IA, 16 00:00:26,420 --> 00:00:27,940 if you wanted it to. 17 00:00:27,940 --> 00:00:30,380 So for infrequently accessed objects, 18 00:00:30,380 --> 00:00:31,930 move them top STANDARD_IA, 19 00:00:31,930 --> 00:00:34,500 for archives objects that we don't need in real time. 20 00:00:34,500 --> 00:00:37,860 The general rule is to move them to GLACIER or DEEP_ARCHIVE. 21 00:00:37,860 --> 00:00:41,100 And so moving all these objects around all these classes 22 00:00:41,100 --> 00:00:42,340 can be done manually, 23 00:00:42,340 --> 00:00:45,280 but it can also be done automatically using something called 24 00:00:45,280 --> 00:00:46,900 a lifecycle configuration. 25 00:00:46,900 --> 00:00:49,380 And configuring those is something you are expected to know 26 00:00:49,380 --> 00:00:50,870 going into the exam. 27 00:00:50,870 --> 00:00:53,070 So lifecycle rules, what are they? 28 00:00:53,070 --> 00:00:55,060 You can define transition actions, 29 00:00:55,060 --> 00:00:57,710 which are helpful when you want to transition your objects 30 00:00:57,710 --> 00:00:59,761 from one storage class to another. For example, 31 00:00:59,761 --> 00:01:03,667 you're saying, "Move objects to Standard IA class 32 00:01:03,667 --> 00:01:05,447 "60 days after creation 33 00:01:05,447 --> 00:01:08,980 "and then move to Glacier for archiving, six months later." 34 00:01:08,980 --> 00:01:11,370 So fairly easy and fairly natural. 35 00:01:11,370 --> 00:01:12,370 Expiration actions, 36 00:01:12,370 --> 00:01:15,290 which is to delete an object after some time. 37 00:01:15,290 --> 00:01:17,160 So for example, your access log files, 38 00:01:17,160 --> 00:01:19,400 maybe you don't need them after another year. 39 00:01:19,400 --> 00:01:20,547 So after a year, you will say, 40 00:01:20,547 --> 00:01:22,607 "Hey, all my files are over a year old. 41 00:01:22,607 --> 00:01:25,010 "Please delete them. Please expire them." 42 00:01:25,010 --> 00:01:28,150 And it could also be used to delete old versions of a file. 43 00:01:28,150 --> 00:01:31,490 So if you have versioning enabled and you keep on overriding 44 00:01:31,490 --> 00:01:32,323 a file, 45 00:01:32,323 --> 00:01:34,120 and you know you won't need the previous versions 46 00:01:34,120 --> 00:01:36,110 after maybe 60 days, 47 00:01:36,110 --> 00:01:38,410 then you can configure an expiration action 48 00:01:38,410 --> 00:01:42,050 to expire objects, old versions of a file, after 60 days. 49 00:01:42,050 --> 00:01:43,750 It can also be used to clean up 50 00:01:43,750 --> 00:01:45,530 and complete multi-part uploads. 51 00:01:45,530 --> 00:01:47,782 In case some parts are hanging around for 30 years and you 52 00:01:47,782 --> 00:01:49,640 know, they will never be completed. 53 00:01:49,640 --> 00:01:51,350 Then you would set up an expire action 54 00:01:51,350 --> 00:01:53,830 to remove these parts. 55 00:01:53,830 --> 00:01:56,440 And rules can be applied for a specific prefix. 56 00:01:56,440 --> 00:02:00,050 So if you have all your MP3 files within the MP3 57 00:02:00,050 --> 00:02:02,400 quote-unquote folder or prefix, 58 00:02:02,400 --> 00:02:04,600 then you can set a life-cycle rule 59 00:02:04,600 --> 00:02:06,640 just for that specific prefix. 60 00:02:06,640 --> 00:02:09,430 So you can have many lifecycle rules based on many prefix 61 00:02:09,430 --> 00:02:11,250 on your buckets. That makes sense. 62 00:02:11,250 --> 00:02:13,410 And you can also have rules created 63 00:02:13,410 --> 00:02:14,800 for a certain object tags. 64 00:02:14,800 --> 00:02:18,260 So if you want to have a rule that applies just to the 65 00:02:18,260 --> 00:02:20,560 objects that are tagged "Department: Finance", 66 00:02:20,560 --> 00:02:22,060 then you can do so. 67 00:02:22,060 --> 00:02:24,130 So the exam will ask you some scenery questions 68 00:02:24,130 --> 00:02:26,860 and here is one and you need to think about it with me. 69 00:02:26,860 --> 00:02:29,860 So your application EC2 creates images thumbnails 70 00:02:29,860 --> 00:02:32,430 after profile photos are uploaded to Amazon S3. 71 00:02:32,430 --> 00:02:34,680 And these thumbnails can be easily recreated 72 00:02:34,680 --> 00:02:38,240 and will only need to be kept for 45 days. 73 00:02:38,240 --> 00:02:41,020 The source images should be able to be immediately retrieved 74 00:02:41,020 --> 00:02:42,360 for these 45 days. 75 00:02:42,360 --> 00:02:45,530 And afterwards the user can wait up to six hours. 76 00:02:45,530 --> 00:02:47,920 How would you design this solution? 77 00:02:47,920 --> 00:02:49,010 So I'll let you think for a second, 78 00:02:49,010 --> 00:02:51,753 please pause the video and then we'll get to the solution. 79 00:02:53,380 --> 00:02:56,830 So the S3 source images can be on the Standard class 80 00:02:56,830 --> 00:02:58,590 and you can set up a lifecycle configuration 81 00:02:58,590 --> 00:03:01,350 to transition them to GLACIER after 45 days. 82 00:03:01,350 --> 00:03:02,183 Why? 83 00:03:02,183 --> 00:03:04,230 Because they need to be archived afterwards 84 00:03:04,230 --> 00:03:07,400 and we can wait up to six hours to retrieve them. 85 00:03:07,400 --> 00:03:10,340 And then for the thumbnails, they can be ONEZONE_IA. 86 00:03:10,340 --> 00:03:11,173 Why? 87 00:03:11,173 --> 00:03:13,230 Because we can recreate them. Okay? 88 00:03:13,230 --> 00:03:15,660 And we can also set up a lifecycle configuration 89 00:03:15,660 --> 00:03:18,920 to expire them or delete them after 45 days. 90 00:03:18,920 --> 00:03:19,960 So that makes sense, right? 91 00:03:19,960 --> 00:03:21,710 We don't need the thumbnails after 45 days. 92 00:03:21,710 --> 00:03:23,000 So let's just delete them. 93 00:03:23,000 --> 00:03:24,262 Let's move the source image to GLACIER. 94 00:03:24,262 --> 00:03:26,570 And the thumbnails can be on ONEZONE_IA 95 00:03:26,570 --> 00:03:28,430 because it's going to be cheaper. 96 00:03:28,430 --> 00:03:31,050 And in case we lose an entire AZ in AWS, 97 00:03:31,050 --> 00:03:33,260 we can easily, from the source image, 98 00:03:33,260 --> 00:03:34,570 recreate all the thumbnails. 99 00:03:34,570 --> 00:03:37,990 So this is going to be providing you the most cost effective 100 00:03:37,990 --> 00:03:39,853 rules for your S3 buckets. 101 00:03:40,810 --> 00:03:42,830 Now in second scenario. 102 00:03:42,830 --> 00:03:45,060 There's a role in your company that states that you should 103 00:03:45,060 --> 00:03:48,130 be able to recover your deleted S3 objects immediately 104 00:03:48,130 --> 00:03:49,380 for 15 days. 105 00:03:49,380 --> 00:03:51,890 Although this may happen rarely, after this time 106 00:03:51,890 --> 00:03:54,900 and up to one year, deleted objects should be recoverable 107 00:03:54,900 --> 00:03:56,490 within 48 hours. 108 00:03:56,490 --> 00:03:59,240 So how would you design this to make it cost effective? 109 00:04:01,240 --> 00:04:02,640 Okay, Let's do it. 110 00:04:02,640 --> 00:04:04,570 So you need to enable S3 versioning, right? 111 00:04:04,570 --> 00:04:06,050 Because we want to delete files, 112 00:04:06,050 --> 00:04:07,910 but we want to be able to recover them. 113 00:04:07,910 --> 00:04:09,680 And so with S3 versioning, 114 00:04:09,680 --> 00:04:11,210 we're going to have object versions 115 00:04:11,210 --> 00:04:13,830 and the deleted objects are going to be hidden 116 00:04:13,830 --> 00:04:14,663 by delete marker, 117 00:04:14,663 --> 00:04:16,709 and they can be easily recovered. 118 00:04:16,709 --> 00:04:18,970 But we're going to have a non-current versions, 119 00:04:18,970 --> 00:04:21,730 basically the object's versions from before. 120 00:04:21,730 --> 00:04:23,680 And so these non-current versions 121 00:04:23,680 --> 00:04:26,380 we want to transition them into S3_IA 122 00:04:26,380 --> 00:04:27,900 because it's very unlikely, 123 00:04:27,900 --> 00:04:30,670 that these old object versions are going to be accessed, 124 00:04:30,670 --> 00:04:32,560 But if it do, are accessed, 125 00:04:32,560 --> 00:04:35,570 then you need to make sure to recover them immediately. 126 00:04:35,570 --> 00:04:38,450 And then afterwards, after these 15 days of grace period, 127 00:04:38,450 --> 00:04:40,630 to recover these non-current versions, 128 00:04:40,630 --> 00:04:43,350 you can transition them into DEEP_ARCHIVE, 129 00:04:43,350 --> 00:04:45,877 such as for 100 and for 365 days. 130 00:04:45,877 --> 00:04:47,490 It can be archived 131 00:04:47,490 --> 00:04:50,300 and they will be recoverable within 48 hours. 132 00:04:50,300 --> 00:04:52,000 Why don't we use just Glacier? 133 00:04:52,000 --> 00:04:52,833 Well, 134 00:04:52,833 --> 00:04:54,460 because Glacier will cost us a little bit more money 135 00:04:54,460 --> 00:04:57,530 because we have a timeline of 48 hours. 136 00:04:57,530 --> 00:04:59,370 And so we can use all the tiers 137 00:04:59,370 --> 00:05:00,690 all the way up to DEEP_ARCHIVE, 138 00:05:00,690 --> 00:05:03,030 to reach your file and get even more savings. 139 00:05:03,030 --> 00:05:04,940 So this is the kind of exam questions you would get. 140 00:05:04,940 --> 00:05:07,450 And it's really important for you to understand exactly 141 00:05:07,450 --> 00:05:10,290 what the question is asking and what's storage class 142 00:05:10,290 --> 00:05:11,810 is corresponding the best to it 143 00:05:11,810 --> 00:05:14,910 and what life cycle rule can also correspond the best to it. 144 00:05:14,910 --> 00:05:16,060 So let's go into the hands-on 145 00:05:16,060 --> 00:05:17,660 just to set up a Lifecycle rule.