1
00:00:00,290 --> 00:00:04,230
<v ->It is possible for you to version your files in Amazon S3.</v>

2
00:00:04,230 --> 00:00:05,540
And so to do this,

3
00:00:05,540 --> 00:00:07,950
you have to enable it at the bucket level.

4
00:00:07,950 --> 00:00:09,560
Okay, it is not at profile setting,

5
00:00:09,560 --> 00:00:11,850
it is a bucket level setting.

6
00:00:11,850 --> 00:00:14,940
Basically that means that if you overwrite a file

7
00:00:14,940 --> 00:00:16,530
you will increment its version.

8
00:00:16,530 --> 00:00:19,090
So when you first upload a file, it is version 1.

9
00:00:19,090 --> 00:00:20,090
Then when you overwrite it,

10
00:00:20,090 --> 00:00:22,240
it is version 2, then version 3, etc.

11
00:00:22,240 --> 00:00:24,110
And your Amazon S3 bucket

12
00:00:24,110 --> 00:00:26,660
will keep all the versions in mind.

13
00:00:26,660 --> 00:00:29,026
It is best practice, to be honest, to version your bucket.

14
00:00:29,026 --> 00:00:29,860
Why?

15
00:00:29,860 --> 00:00:31,580
Well, because you can protect yourself

16
00:00:31,580 --> 00:00:33,280
against unintended deletes.

17
00:00:33,280 --> 00:00:36,100
Basically you're able to restore a previous version.

18
00:00:36,100 --> 00:00:38,920
And you can easily roll back to your previous version

19
00:00:38,920 --> 00:00:40,630
in case there was any problem.

20
00:00:40,630 --> 00:00:43,040
So this is quite best practice, to version your buckets.

21
00:00:43,040 --> 00:00:44,900
The only downside is that you use a bit more

22
00:00:44,900 --> 00:00:46,803
space on your Amazon S3 bucket.

23
00:00:47,710 --> 00:00:50,130
Finally, any file that is not versioned

24
00:00:50,130 --> 00:00:51,820
prior to enabling the versioning,

25
00:00:51,820 --> 00:00:53,510
will have the version null.

26
00:00:53,510 --> 00:00:54,760
And this is just something that you should know

27
00:00:54,760 --> 00:00:56,780
in case they ask this at the exam.

28
00:00:56,780 --> 00:00:59,340
So let's go ahead and practice this in the hands-on.

29
00:00:59,340 --> 00:01:00,860
So I'm in my S3 bucket.

30
00:01:00,860 --> 00:01:02,480
And I will go to properties

31
00:01:02,480 --> 00:01:04,400
click on versioning, and as you can see,

32
00:01:04,400 --> 00:01:06,100
I can enable versioning.

33
00:01:06,100 --> 00:01:09,363
Then I click on save and it says enabled.

34
00:01:10,680 --> 00:01:12,440
Then I go back to overview

35
00:01:12,440 --> 00:01:13,610
and now you should be seeing

36
00:01:13,610 --> 00:01:18,320
a versions hide and show type of toggle, right here.

37
00:01:18,320 --> 00:01:19,230
So I'll click on show

38
00:01:19,230 --> 00:01:21,400
and if you don't see this, refresh the page,

39
00:01:21,400 --> 00:01:22,860
go back to your properties and refresh this.

40
00:01:22,860 --> 00:01:25,540
Sometimes it takes a bit of time to enable versioning.

41
00:01:25,540 --> 00:01:27,490
So you go to overview and you show the versions.

42
00:01:27,490 --> 00:01:30,490
And the first thing we see is that the coffee.jpg file,

43
00:01:30,490 --> 00:01:33,370
that was uploaded before we enabled versioning

44
00:01:33,370 --> 00:01:35,420
has a version ID null.

45
00:01:35,420 --> 00:01:37,430
So we just saw this in the lecture.

46
00:01:37,430 --> 00:01:40,010
Now if I open a file, add a file

47
00:01:40,010 --> 00:01:44,260
and make this file my beach.jpg, upload it.

48
00:01:44,260 --> 00:01:47,180
As you can see my first beach is here

49
00:01:47,180 --> 00:01:49,330
and has a version ID like this.

50
00:01:49,330 --> 00:01:50,970
So I did an oversimplification

51
00:01:50,970 --> 00:01:52,210
when I said version 1, 2 and 3

52
00:01:52,210 --> 00:01:54,940
but you get the idea that basically your file

53
00:01:54,940 --> 00:01:56,750
gets a new version every time.

54
00:01:56,750 --> 00:01:59,550
So if I go ahead and re-upload the very same file,

55
00:01:59,550 --> 00:02:02,730
so add a file and re-upload that beach,

56
00:02:02,730 --> 00:02:04,220
basically you can see that now

57
00:02:04,220 --> 00:02:06,570
the new version has a new version ID.

58
00:02:06,570 --> 00:02:09,870
And it overridden the version from before.

59
00:02:09,870 --> 00:02:10,940
So we can look at the timestamps

60
00:02:10,940 --> 00:02:13,567
and see that this one was created at 35:59pm

61
00:02:13,567 --> 00:02:16,050
and this one is 35:40pm, okay.

62
00:02:16,050 --> 00:02:17,590
So we see different versions.

63
00:02:17,590 --> 00:02:20,330
So we can go ahead and upload as many versions as you want.

64
00:02:20,330 --> 00:02:22,490
So we can re-upload the beach.

65
00:02:22,490 --> 00:02:23,650
I'll go ahead and re-upload the beach

66
00:02:23,650 --> 00:02:28,010
and I'll also go ahead and upload a coffee.jpg

67
00:02:28,010 --> 00:02:29,310
just see how things work.

68
00:02:29,310 --> 00:02:33,500
And as we can see now, even the coffee gets a version ID.

69
00:02:33,500 --> 00:02:35,740
So basically as we have versioning,

70
00:02:35,740 --> 00:02:39,800
now every object version gets kept into the bucket.

71
00:02:39,800 --> 00:02:41,630
If we hide the version we only see

72
00:02:41,630 --> 00:02:43,400
the latest version in our UI.

73
00:02:43,400 --> 00:02:46,870
But if we show the version we can see all the version IDs.

74
00:02:46,870 --> 00:02:48,400
The other thing that's super interesting

75
00:02:48,400 --> 00:02:49,730
is that if I delete my files

76
00:02:49,730 --> 00:02:53,130
so let's go ahead and right-click and delete my file,

77
00:02:53,130 --> 00:02:55,270
and I say yes, I want to delete it,

78
00:02:55,270 --> 00:02:58,090
it looks like it's gone if I hide the versions.

79
00:02:58,090 --> 00:03:00,350
But if I show the versions we can see

80
00:03:00,350 --> 00:03:01,790
that the only thing that happened

81
00:03:01,790 --> 00:03:04,510
is that there was a delete marker on that file.

82
00:03:04,510 --> 00:03:07,580
And so basically I'm able to restore it if I wanted to.

83
00:03:07,580 --> 00:03:09,017
So here is the download file

84
00:03:09,017 --> 00:03:11,160
and I could restore it if I wanted to.

85
00:03:11,160 --> 00:03:13,620
But the idea is that now that you have versioning

86
00:03:13,620 --> 00:03:16,307
when you delete a file, it just puts a delete marker on it

87
00:03:16,307 --> 00:03:19,360
and just creates a new version of that file for you.

88
00:03:19,360 --> 00:03:20,710
So that's it for versioning.

89
00:03:20,710 --> 00:03:21,980
It's all you need to know.

90
00:03:21,980 --> 00:03:23,340
Just remember you create new versions

91
00:03:23,340 --> 00:03:25,110
every time you upload a file.

92
00:03:25,110 --> 00:03:27,250
When you delete a file it's just not really deleted.

93
00:03:27,250 --> 00:03:29,150
It has a delete marker on it.

94
00:03:29,150 --> 00:03:30,900
And when you enable versioning,

95
00:03:30,900 --> 00:03:35,380
any file that wasn't versioned before, has the null version.

96
00:03:35,380 --> 00:03:36,213
So, I hope that was helpful.

97
00:03:36,213 --> 00:03:38,960
Hope that helps and I will see you in the next lecture.

