1 00:00:07,189 --> 00:00:13,230 Welcome back to Backspace Academy. In this hands-on session I'm going to be 2 00:00:13,230 --> 00:00:16,514 looking at the versioning features of Amazon s3 3 00:00:16,514 --> 00:00:18,330 once we've done that we'll 4 00:00:18,330 --> 00:00:24,510 look at how we can use a life cycle rule to migrate old versions of our objects 5 00:00:24,510 --> 00:00:29,348 over to an archiving solution like Amazon Glacier 6 00:00:29,348 --> 00:00:32,137 okay so starting off in the s3 console 7 00:00:32,137 --> 00:00:37,430 I'm just going to before we start I'm going to talk about this bucket here 8 00:00:37,430 --> 00:00:41,220 what it is it's a bucket there that's been created by the Elastic Beanstalk service 9 00:00:41,220 --> 00:00:45,510 now I've been getting a lot of messages from students saying 10 00:00:45,510 --> 00:00:49,350 oh I've got this bucket here I don't know what it is I'm trying to delete it 11 00:00:49,350 --> 00:00:52,620 I can't delete it and they're really concerned they're going to get a bill 12 00:00:52,620 --> 00:00:53,660 for that bucket 13 00:00:53,660 --> 00:00:56,129 now provided that bucket is empty and all you need to do is just 14 00:00:56,129 --> 00:00:59,940 click on it and then select empty bucket and you'll be able to empty that bucket 15 00:00:59,940 --> 00:01:04,350 provided it's empty you're not going to get billed for it and you won't be able 16 00:01:04,350 --> 00:01:09,630 to delete it because it's used by the Elastic Beanstalk service and so next 17 00:01:09,630 --> 00:01:14,700 time you use Elastic Beanstalk in that region it will use that bucket to store 18 00:01:14,700 --> 00:01:16,680 its data so don't be too concerned about it 19 00:01:16,680 --> 00:01:18,656 just make sure it's empty if you see it 20 00:01:18,656 --> 00:01:20,430 so I'm going to do now is just very 21 00:01:20,430 --> 00:01:24,340 quickly create a bucket it doesn't matter what we call it as long as it's unique 22 00:01:24,340 --> 00:01:27,710 and we've got an option here for versioning 23 00:01:27,710 --> 00:01:29,680 now we want to do that 24 00:01:29,680 --> 00:01:34,290 we want to keep track of the different versions that are being uploaded inside 25 00:01:34,290 --> 00:01:41,774 of this this bucket and next and next and create that bucket 26 00:01:41,774 --> 00:01:47,280 so what I've got here is a text file and all that simply says is this is version one 27 00:01:47,280 --> 00:01:51,259 we're going to upload that and then we'll apply it over the top of that 28 00:01:51,259 --> 00:01:51,759 version two and then we'll see we get the old version one back again 29 00:01:51,759 --> 00:02:01,939 so just jump into that bucket and we'll upload this version one 30 00:02:05,540 --> 00:02:10,180 so we'll upload that and then we'll create another version of this called version 2 31 00:02:10,180 --> 00:02:14,980 and I'll just save that and I'm going to upload that over the version 1 32 00:02:14,980 --> 00:02:28,380 and see what happens okay so that's finished uploading what I'm going 33 00:02:28,380 --> 00:02:32,130 to do is have a look at it and download it and see what it see what one it is 34 00:02:32,130 --> 00:02:38,040 here so there we go so version 2 is the one that's that's there in our bucket 35 00:02:38,040 --> 00:02:43,050 that we can see now what if we want to get back version 1 so what we can do is 36 00:02:43,050 --> 00:02:46,920 go back to that bucket and we can look at the version history here so we just 37 00:02:46,920 --> 00:02:51,420 see here we've got versions and we can show the different versions of our 38 00:02:51,420 --> 00:02:57,090 objects so there is our latest version and there is our old version so if we 39 00:02:57,090 --> 00:03:03,180 want to revert back to that that old version we can simply delete that last 40 00:03:03,180 --> 00:03:15,989 one there and delete it and so now when we go back in and we just hide the 41 00:03:15,989 --> 00:03:22,650 versions if we go back into our text.txt we download that again that should 42 00:03:22,650 --> 00:03:27,239 show our original version so there it is this is version 1 so that's how simple 43 00:03:27,239 --> 00:03:33,690 and easy it is to go back in the version history and find the version you want 44 00:03:33,690 --> 00:03:37,470 what happens if we completely delete it so let's just do that we're going to 45 00:03:37,470 --> 00:03:45,810 completely delete that object so it's deleted so there we go the bucket is 46 00:03:45,810 --> 00:03:51,480 empty the object has been deleted but we can also go back in our versions we can 47 00:03:51,480 --> 00:03:57,630 find it again so we click on show and there we can see that there is our old 48 00:03:57,630 --> 00:04:02,730 version and we've also got this thing here called a delete marker so what we 49 00:04:02,730 --> 00:04:09,450 can do is if we delete this delete marker it will undelete that object so 50 00:04:09,450 --> 00:04:15,419 we just go there and we go more and more delete so we've deleted that marker here 51 00:04:15,419 --> 00:04:20,820 we go back and hide our versions there we go our test dot text has come 52 00:04:20,820 --> 00:04:25,200 back again so that's a really good thing so if you accidentally delete stuff and 53 00:04:25,200 --> 00:04:28,980 you've got versioning enabled just go back in the version history delete the 54 00:04:28,980 --> 00:04:33,583 delete marker and you've got it back again 55 00:04:33,583 --> 00:04:37,200 now what if we want to save costs 56 00:04:37,200 --> 00:04:42,210 and we want and we don't want to keep all of these old versions of our objects 57 00:04:42,210 --> 00:04:47,400 in our bucket we want to store them somewhere that is low costs for example 58 00:04:47,400 --> 00:04:52,500 on Amazon Glacier for archiving so what we can do is we can set up a lifecycle rule 59 00:04:52,500 --> 00:04:58,410 and what it will do it will get old versions of our objects for example we 60 00:04:58,410 --> 00:05:02,640 can get our versions that are for example 90 days old and then we can 61 00:05:02,640 --> 00:05:09,240 migrate those over to Amazon and Glacier and we can do that and save costs and at 62 00:05:09,240 --> 00:05:15,480 the same time we can also get those objects back if need be we can also set 63 00:05:15,480 --> 00:05:21,960 up a lifecycle rule to expire objects for the current version or previous 64 00:05:21,960 --> 00:05:26,810 versions so that after a certain amount of time for example say after two years 65 00:05:26,810 --> 00:05:31,710 then all versions or all previous versions of an object will be 66 00:05:31,710 --> 00:05:35,580 permanently deleted so it will be permanently deleted off Glacier and off 67 00:05:35,580 --> 00:05:42,420 everything so that is going to help you to manage the lifecycle of your objects 68 00:05:42,420 --> 00:05:46,080 about you having to actually do anything at all it's going to save you a lot of 69 00:05:46,080 --> 00:05:50,390 costs and a lot of headaches so how do we do that so we go into management and 70 00:05:50,390 --> 00:05:58,380 add a lifecycle rule we're just going to call this test rule and that will do we 71 00:05:58,380 --> 00:06:03,960 won't add a filter to it we click on next and we're going to apply this for 72 00:06:03,960 --> 00:06:09,780 previous versions of objects so what we can do now is we can add a transition so 73 00:06:09,780 --> 00:06:16,440 we want to transition from this bucket over to Amazon Glacier for our previous 74 00:06:16,440 --> 00:06:22,920 versions when they are for example must choose 90 days old so what's going to 75 00:06:22,920 --> 00:06:27,900 happen if we upload another object and we've got an old version then after 90 76 00:06:27,900 --> 00:06:31,559 days it will be migrated across to Amazon Glacier 77 00:06:31,559 --> 00:06:35,299 and that's going to save us a lot of costs click on next 78 00:06:35,299 --> 00:06:40,739 what we can also do is we can permanently delete objects or old 79 00:06:40,739 --> 00:06:44,609 versions of objects after a certain amount of time as well so what we'll do 80 00:06:44,609 --> 00:06:49,259 is we'll click on previous versions and we can permanently delete previous 81 00:06:49,259 --> 00:06:55,259 versions after whatever time they're so 455 days there so that's going to 82 00:06:55,259 --> 00:07:00,149 permanently delete that off everything off Glacier if it's if it's gone to 83 00:07:00,149 --> 00:07:03,809 Glacier it will permanently delete that off that and so that's going to again 84 00:07:03,809 --> 00:07:07,649 save you costs on Glacier for very old versions that you're not going to be 85 00:07:07,649 --> 00:07:12,779 needing we can also clean up expired object delete markers and incomplete 86 00:07:12,779 --> 00:07:20,219 multi-up multi-part uploads as well so we'll click on next and save that and so 87 00:07:20,219 --> 00:07:27,419 that's how simple it is to actually manage your archiving solution using 88 00:07:27,419 --> 00:07:32,219 Amazon s3 so you can use it for your live storage here you can get access to 89 00:07:32,219 --> 00:07:38,759 it instantaneously but at the same time you can migrate that over based on a 90 00:07:38,759 --> 00:07:43,949 rule over to cheaper versions and then finally delete it when it is guaranteed 91 00:07:43,949 --> 00:07:47,879 you're not going to need it anymore so that brings us to the end of their 92 00:07:47,879 --> 00:07:54,419 hands-on demonstration on s3 versioning and lifecycle rules I look forward to 93 00:07:54,419 --> 00:07:57,739 seeing you in the next one