1 00:00:00,231 --> 00:00:02,850 So next, let's explore versioning 2 00:00:02,850 --> 00:00:04,689 in our S3 Buckets. 3 00:00:04,689 --> 00:00:07,520 So for now, we just uploaded a copy of the jpg, 4 00:00:07,520 --> 00:00:10,690 and we didn't enable versioning when we created the buckets, 5 00:00:10,690 --> 00:00:12,750 But let's go into the Properties tab, 6 00:00:12,750 --> 00:00:14,700 and the first setting into the Properties tab 7 00:00:14,700 --> 00:00:16,520 is called Bucket Versioning. 8 00:00:16,520 --> 00:00:17,810 So let's edit it, 9 00:00:17,810 --> 00:00:19,420 and move the Bucket Versioning 10 00:00:19,420 --> 00:00:22,384 from being suspended to being enabled. 11 00:00:22,384 --> 00:00:24,217 I will click on save changes, 12 00:00:24,217 --> 00:00:25,050 and here we go. 13 00:00:25,050 --> 00:00:27,680 Our bucket is now enabled for versioning. 14 00:00:27,680 --> 00:00:30,870 So let's close this and go back to our Objects. 15 00:00:30,870 --> 00:00:31,703 Great. 16 00:00:31,703 --> 00:00:33,870 So this is our first object. 17 00:00:33,870 --> 00:00:36,100 But now that we have enabled versioning, 18 00:00:36,100 --> 00:00:39,120 we have a new setting here called List Versions. 19 00:00:39,120 --> 00:00:41,570 This toggle right here, if I click on it, 20 00:00:41,570 --> 00:00:44,800 will add a column into the view of Amazon S3, 21 00:00:44,800 --> 00:00:46,506 which shows me the version ID. 22 00:00:46,506 --> 00:00:49,081 And it turns out that's for coffee.jpg, 23 00:00:49,081 --> 00:00:50,872 the version ID is null. 24 00:00:50,872 --> 00:00:53,555 That means that we have uploaded this object 25 00:00:53,555 --> 00:00:57,000 before we enabled versioning onto our bucket, 26 00:00:57,000 --> 00:00:59,140 and therefore it will not have a version ID, 27 00:00:59,140 --> 00:01:00,730 hence the term null. 28 00:01:00,730 --> 00:01:03,250 But let's try to upload a new file, 29 00:01:03,250 --> 00:01:06,260 and this time, we're going to upload the beach picture. 30 00:01:06,260 --> 00:01:07,663 So beach.jpg. 31 00:01:07,663 --> 00:01:10,523 I will scroll down and upload. 32 00:01:11,400 --> 00:01:12,850 Now that file has been uploaded, 33 00:01:12,850 --> 00:01:16,043 let's go back to our buckets and list diversions. 34 00:01:16,043 --> 00:01:17,954 Now we can find that the beach.jpg 35 00:01:17,954 --> 00:01:20,112 has a version that is a very long string. 36 00:01:20,112 --> 00:01:21,875 And so this makes sense. 37 00:01:21,875 --> 00:01:25,200 As we have uploaded a version of the file 38 00:01:25,200 --> 00:01:27,230 after enabling bucket versioning, 39 00:01:27,230 --> 00:01:30,290 it's going to be assigned a version ID. 40 00:01:30,290 --> 00:01:35,290 Okay, what about if we upload the beach.jpg file again? 41 00:01:36,280 --> 00:01:39,743 So let's upload beach.jpg, and see what happens. 42 00:01:43,440 --> 00:01:46,010 Okay, back in here, I still have two objects, 43 00:01:46,010 --> 00:01:47,604 but if I list my versions, 44 00:01:47,604 --> 00:01:50,930 now we can see that beach.jpg has two version IDs. 45 00:01:50,930 --> 00:01:53,650 This one is the one we applied from before, 46 00:01:53,650 --> 00:01:56,630 and this one is the new version ID 47 00:01:56,630 --> 00:01:58,130 we just uploaded right now. 48 00:01:58,130 --> 00:01:59,900 So as we can see thanks to versioning, 49 00:01:59,900 --> 00:02:01,780 every time we re-upload a file, 50 00:02:01,780 --> 00:02:03,755 it will keep all its previous versions, 51 00:02:03,755 --> 00:02:05,204 as well as the new version 52 00:02:05,204 --> 00:02:09,060 and assign a different version ID every single time. 53 00:02:09,060 --> 00:02:10,270 So this is cool. 54 00:02:10,270 --> 00:02:12,870 Now what happens if we upload another time 55 00:02:12,870 --> 00:02:15,160 the coffee.jpg file? 56 00:02:15,160 --> 00:02:17,793 So let's try it out. We'll upload the coffee.jpg. 57 00:02:19,240 --> 00:02:20,073 Upload. 58 00:02:21,570 --> 00:02:22,710 Great. 59 00:02:22,710 --> 00:02:25,100 Back in here, list versions. 60 00:02:25,100 --> 00:02:27,420 We can see that coffee.jpg has two versions. 61 00:02:27,420 --> 00:02:28,920 The first version that we just uploaded 62 00:02:28,920 --> 00:02:30,470 has a long version ID, 63 00:02:30,470 --> 00:02:34,040 and the one from before has the version ID null. 64 00:02:34,040 --> 00:02:35,039 Okay, this is great. 65 00:02:35,039 --> 00:02:38,990 Now let's try to unlist the object version. 66 00:02:38,990 --> 00:02:41,400 So we just have these two files right here, 67 00:02:41,400 --> 00:02:43,927 and let's try to delete a file. 68 00:02:43,927 --> 00:02:47,330 So for example, let's take the beach.jpg, 69 00:02:47,330 --> 00:02:48,530 and let's try to delete it. 70 00:02:48,530 --> 00:02:49,580 So I click on Delete, 71 00:02:50,450 --> 00:02:52,290 and as you can see, we get an information 72 00:02:52,290 --> 00:02:54,560 saying deleting the specified objects 73 00:02:54,560 --> 00:02:56,930 adds delete markers to them. 74 00:02:56,930 --> 00:02:58,890 So we're actually not deleting the file itself, 75 00:02:58,890 --> 00:03:00,040 we're adding a delete marker. 76 00:03:00,040 --> 00:03:01,580 Let's see whether it's been so. 77 00:03:01,580 --> 00:03:06,520 Let's confirm we want to delete beach.jpg, and press Delete. 78 00:03:06,520 --> 00:03:09,130 Okay, so this is done. 79 00:03:09,130 --> 00:03:11,420 The object has been successfully deleted. 80 00:03:11,420 --> 00:03:12,850 Let's exit this. 81 00:03:12,850 --> 00:03:16,950 Scroll down, and yes, it seems that's my beach.jpg 82 00:03:16,950 --> 00:03:18,207 has been deleted. 83 00:03:18,207 --> 00:03:21,740 But actually, if I click on list versions, 84 00:03:21,740 --> 00:03:23,380 this toggle again, 85 00:03:23,380 --> 00:03:25,640 well, we can see that beach.jpg is still here. 86 00:03:25,640 --> 00:03:28,570 But now, on top of the two previous versions 87 00:03:28,570 --> 00:03:29,700 we have uploaded, 88 00:03:29,700 --> 00:03:31,340 we have a delete marker. 89 00:03:31,340 --> 00:03:33,690 And this delete marker has its own version ID 90 00:03:33,690 --> 00:03:36,860 of size zero bytes, and is same to AWS, 91 00:03:36,860 --> 00:03:38,842 make it seem like this file is gone, 92 00:03:38,842 --> 00:03:41,030 but actually, it's not gone, 93 00:03:41,030 --> 00:03:43,540 it just has a delete marker. 94 00:03:43,540 --> 00:03:46,600 And so how can I restore a file? 95 00:03:46,600 --> 00:03:51,470 Well, I can just take this and delete the Delete marker. 96 00:03:51,470 --> 00:03:53,210 Now, deleting a delete marker 97 00:03:53,210 --> 00:03:55,310 or deleting a specific version ID 98 00:03:55,310 --> 00:03:57,360 is called a permanent delete. 99 00:03:57,360 --> 00:04:00,360 So if I take, for example, these two files right here, 100 00:04:00,360 --> 00:04:01,330 these two versions, 101 00:04:01,330 --> 00:04:03,100 the Delete marker and the previous version 102 00:04:03,100 --> 00:04:06,328 because I want to delete two at once, I click on delete. 103 00:04:06,328 --> 00:04:08,230 Now, instead of just saying delete, 104 00:04:08,230 --> 00:04:10,250 it says you need to permanently delete 105 00:04:10,250 --> 00:04:12,700 because I'm deleting specific version ID, 106 00:04:12,700 --> 00:04:14,860 so it is a destructive operation 107 00:04:14,860 --> 00:04:16,329 before it edited delete marker, 108 00:04:16,329 --> 00:04:19,620 but not we're actually deleting the objects for good. 109 00:04:19,620 --> 00:04:21,899 So this cannot be undone. 110 00:04:21,899 --> 00:04:23,610 I click on Delete objects, 111 00:04:23,610 --> 00:04:25,660 and my objects have been deleted. 112 00:04:25,660 --> 00:04:30,660 Going back into my bucket one more time, what do we see? 113 00:04:30,770 --> 00:04:33,170 We see my beach and my coffee.jpgs are back. 114 00:04:33,170 --> 00:04:34,190 And if I list versions, 115 00:04:34,190 --> 00:04:37,020 I only have one version for my beach.jpg, which makes sense. 116 00:04:37,020 --> 00:04:40,600 this is exactly in line with the operation we just did. 117 00:04:40,600 --> 00:04:44,540 Okay. And so this allows us to roll back 118 00:04:44,540 --> 00:04:46,723 a previous version and restore a previous version, 119 00:04:47,910 --> 00:04:49,280 thanks to the versioning. 120 00:04:49,280 --> 00:04:50,880 Okay. And this is quite cool 121 00:04:50,880 --> 00:04:53,800 because, well if someone goes and deletes a file, 122 00:04:53,800 --> 00:04:54,870 and we have enabled versioning 123 00:04:54,870 --> 00:04:57,480 as long as it deletes a specific object version, 124 00:04:57,480 --> 00:05:01,000 we have prevented against unintended delete. 125 00:05:01,000 --> 00:05:03,540 And finally, for Bucket Versioning, 126 00:05:03,540 --> 00:05:04,740 you could go and disable it, 127 00:05:04,740 --> 00:05:06,560 it is not suspend it. 128 00:05:06,560 --> 00:05:08,120 So if you do suspend it, 129 00:05:08,120 --> 00:05:09,733 this is going to keep all the previous versions 130 00:05:09,733 --> 00:05:11,200 that you had from before, 131 00:05:11,200 --> 00:05:12,210 but for the new objects, 132 00:05:12,210 --> 00:05:14,920 they will have in version ID of null 133 00:05:14,920 --> 00:05:17,810 and we will replace all the existing previous versions. 134 00:05:17,810 --> 00:05:21,123 Okay. Now I'm going to keep Bucket Versioning on 135 00:05:21,123 --> 00:05:24,090 because I need it for the rest of my demos. 136 00:05:24,090 --> 00:05:25,850 So that's it for this part, 137 00:05:25,850 --> 00:05:28,800 I hope you liked it and I will see you in the next lecture.