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