1
00:00:00,090 --> 00:00:05,790
So let's talk about AWOL Linda versions because as soon as you start working on limbs of functions and

2
00:00:05,890 --> 00:00:07,500
put him and death tests brought.

3
00:00:07,500 --> 00:00:11,820
This is where functions and aliases that was in the next line are really really important.

4
00:00:12,390 --> 00:00:17,960
So when you work on the function you work on the version called latest and that makes sense.

5
00:00:18,000 --> 00:00:24,090
The latest version is what you modify and so lettuce is mutable mutable means that we can change it

6
00:00:24,210 --> 00:00:29,770
as we want when we're ready to publish dysfunction when we are happy with the status of this function

7
00:00:30,120 --> 00:00:32,880
we can publish it and create a version.

8
00:00:32,880 --> 00:00:35,900
So the first version we create will be the one for example.

9
00:00:35,970 --> 00:00:38,550
And that version is immutable.

10
00:00:38,550 --> 00:00:45,210
That means that the V1 we cannot change it ever is the snapshots and versions gets increasing their

11
00:00:45,210 --> 00:00:45,620
numbers.

12
00:00:45,630 --> 00:00:49,400
So after V1 we will have V2.

13
00:00:49,560 --> 00:00:55,230
Now the versions each of them will get their own HRN Aaron is Amazon resource name.

14
00:00:55,230 --> 00:01:01,350
So that means we're able to address either V1 or V2 or latest based on different ends.

15
00:01:01,680 --> 00:01:06,330
And the version is the code itself and the configuration.

16
00:01:06,330 --> 00:01:10,040
So environment variables time outs et cetera nothing can be changed.

17
00:01:10,050 --> 00:01:12,410
Everything is immutable.

18
00:01:12,520 --> 00:01:18,600
And so each version of the land the function including latest can be accessed whenever you want using

19
00:01:18,600 --> 00:01:20,010
the correct A R.

20
00:01:20,370 --> 00:01:25,980
So now workflow when we work and we're happy with a state of LMA function we say okay we'll going to

21
00:01:25,980 --> 00:01:30,430
snapshot latest and we're going to create a new version out of it.

22
00:01:30,540 --> 00:01:31,800
Why would we do this.

23
00:01:31,800 --> 00:01:37,800
Well we create versions in order to have a dev environment a test environment and a prod environment.

24
00:01:37,800 --> 00:01:38,070
Right.

25
00:01:38,590 --> 00:01:45,560
But so if we have new versions of the time we have to rewire everything in dev test prod all the time.

26
00:01:45,570 --> 00:01:47,880
And that may be super painful.

27
00:01:47,880 --> 00:01:54,330
Instead we can use lambda aliases and so aliases are pointers to lend the function versions.

28
00:01:54,420 --> 00:01:58,100
So versions where immutable and aliases are not.

29
00:01:58,260 --> 00:02:04,530
So we can define for example a dev test and prod alias and we punted them to different lambda versions

30
00:02:04,560 --> 00:02:08,560
and we can change these pointers over time because they're immutable.

31
00:02:08,580 --> 00:02:11,970
So here is our latest lambda function version it's mutable.

32
00:02:12,120 --> 00:02:14,490
But we also have V1 and V2.

33
00:02:14,490 --> 00:02:19,890
Now we can create a dev alias which represents our development environment which most likely we want

34
00:02:19,890 --> 00:02:22,850
to point at the latest function we have.

35
00:02:22,860 --> 00:02:26,070
So we'll point the dev alias to latest.

36
00:02:26,070 --> 00:02:32,070
Now our users when they interact with our function that don't directly interact with the latest version

37
00:02:32,280 --> 00:02:37,670
they interact with the dev alias Now we also have a test alias maybe.

38
00:02:37,840 --> 00:02:41,140
And we're actually testing our V2 of our function.

39
00:02:41,140 --> 00:02:48,310
So the test alias may point to the V2 and maybe we have a prod function and the proud alias is going

40
00:02:48,310 --> 00:02:50,980
to point directly to V1.

41
00:02:51,010 --> 00:02:56,600
So as you can see all the aliases are mutable whereas the versions are immutable.

42
00:02:56,740 --> 00:03:03,040
And so if we want to do blue green deployment or updates are proud environments to migrate it from the

43
00:03:03,040 --> 00:03:05,710
one to V2 because it turns out it was great.

44
00:03:05,710 --> 00:03:12,310
We can do a deployment and assign weights so we can say the proud alias Ninety five percent of this

45
00:03:12,310 --> 00:03:17,160
is going to point to view 1 and 5 percent of it is going to point to V2.

46
00:03:17,290 --> 00:03:23,070
This way we're going to test with a little bit of traffic how the V2 function is doing.

47
00:03:23,350 --> 00:03:29,260
And so using this we can do blue green deployments our users don't know what's happening at all because

48
00:03:29,260 --> 00:03:32,210
the only thing they interact with is the aliases.

49
00:03:32,380 --> 00:03:34,510
So for the users nothing changes.

50
00:03:34,510 --> 00:03:41,230
And so we're able to iterate basically in the backend while providing a stable configuration for our

51
00:03:41,230 --> 00:03:48,470
users are even triggers in our destinations so we can change all we want and rewire the aliases to functions.

52
00:03:48,550 --> 00:03:52,550
But for the users the endpoints are the same.

53
00:03:52,630 --> 00:03:57,250
And that's because aliases will have their own HRN So that makes sense.

54
00:03:57,250 --> 00:04:01,520
We will go right now into a hands on probably to give it a bit more clarity.

55
00:04:01,540 --> 00:04:07,420
So now let's play with these versions and aliases so let's modify our function a little bit make it

56
00:04:07,480 --> 00:04:08,610
a bit more simple.

57
00:04:08,650 --> 00:04:14,080
So I'm going to remove everything about the environment variables and I'm going to just import Jason.

58
00:04:14,080 --> 00:04:14,870
Here we go.

59
00:04:14,950 --> 00:04:18,060
And the return is going to be something very simple.

60
00:04:18,100 --> 00:04:19,240
I'm going to return.

61
00:04:19,300 --> 00:04:20,420
Hello world.

62
00:04:20,430 --> 00:04:20,990
OK.

63
00:04:21,050 --> 00:04:25,850
And so this is our function this returns of the world and you save it and everything works fine.

64
00:04:25,870 --> 00:04:30,650
And so if we test it it should go ahead and says hello world excellence.

65
00:04:30,700 --> 00:04:32,390
Now let's go look at qualifiers.

66
00:04:32,560 --> 00:04:38,490
So we have our versions and then we have aliases and so both are saying latest and latest.

67
00:04:38,560 --> 00:04:41,500
But what we should do now is publish our first lambda version.

68
00:04:41,530 --> 00:04:42,940
So we're very happy with this function.

69
00:04:42,940 --> 00:04:44,340
We're very happy would does.

70
00:04:44,470 --> 00:04:52,780
So I'm going to go ahead and click action and publish new version and I'll call it version 1 and publish.

71
00:04:52,780 --> 00:04:53,140
Here we go.

72
00:04:53,440 --> 00:05:00,580
So my first version called one and the description is version 1 has been created 31 seconds ago.

73
00:05:00,770 --> 00:05:02,710
And we're very happy with it.

74
00:05:02,800 --> 00:05:03,810
And this is our version 1.

75
00:05:03,850 --> 00:05:05,290
And this is immutable.

76
00:05:05,290 --> 00:05:07,510
So I'm trying right now to change the code but I cannot.

77
00:05:07,660 --> 00:05:08,080
OK.

78
00:05:08,200 --> 00:05:11,620
So once you publish a version the version cannot be changed at all.

79
00:05:11,620 --> 00:05:18,930
So now version 1 is lambda dummy and contains this code and cannot ever be changed to change the code.

80
00:05:18,940 --> 00:05:20,190
We need you go to latest.

81
00:05:20,440 --> 00:05:24,040
So we switch to version latest and here we're able to change the code.

82
00:05:24,040 --> 00:05:29,880
So maybe I'll say goodbye world and save this function.

83
00:05:29,890 --> 00:05:35,650
So now we have saved latest and to publish this new version I click on published new version and I call

84
00:05:35,650 --> 00:05:41,420
it updated lambda function to say goodbye.

85
00:05:41,650 --> 00:05:42,690
OK.

86
00:05:42,910 --> 00:05:43,810
And click on publish.

87
00:05:44,230 --> 00:05:49,720
So now we have to them the functions we have Version 1 and 2 version 1 says how the world and this one

88
00:05:49,720 --> 00:05:54,990
says goodbye world we can test it and say Yes this one says goodbye world excellence.

89
00:05:55,450 --> 00:05:58,210
So now how do we go about creating aliases.

90
00:05:58,240 --> 00:06:01,480
So this is our development cycle we keep on creating new versions.

91
00:06:01,480 --> 00:06:04,240
But what we'd like to have is a dev and a prod alias.

92
00:06:04,240 --> 00:06:04,900
Right.

93
00:06:04,900 --> 00:06:11,170
So let's go through actions and create an alias and the first one is going to be called dev and Dev

94
00:06:11,200 --> 00:06:12,490
aliens make sense.

95
00:06:12,490 --> 00:06:22,450
Dave is the latest version of our lambda function and the version is going to point to is latest.

96
00:06:22,450 --> 00:06:22,960
OK.

97
00:06:23,140 --> 00:06:24,150
So what Cregan creates.

98
00:06:24,280 --> 00:06:29,990
And now any time we refer to the alias Dev this is going to point to the latest version.

99
00:06:30,010 --> 00:06:35,590
So if we make some modification to latest so let's go ahead and our function and make some modifications.

100
00:06:35,590 --> 00:06:43,810
So I will grant your rights 42 and click on Save and now test its function.

101
00:06:43,830 --> 00:06:45,930
So this function returns 42.

102
00:06:46,100 --> 00:06:53,280
And if you click on the alias dev and test this function it's also going to return 42 because our alias

103
00:06:53,280 --> 00:06:55,680
dev is pointing to the latest version.

104
00:06:55,680 --> 00:06:57,860
But we're going to create another alias.

105
00:06:57,930 --> 00:07:00,360
We're going to create the proud alias.

106
00:07:00,360 --> 00:07:07,830
And this one is our most stable version of our lambda function.

107
00:07:07,830 --> 00:07:10,340
And the version is going to point to is version 1.

108
00:07:10,560 --> 00:07:11,970
And the second creates.

109
00:07:11,970 --> 00:07:17,180
So now we have the proud alias and the proud alias right now as you can see is pointing to version 1.

110
00:07:17,250 --> 00:07:22,860
But the idea with aliases is that if you look at the air and hear the kind of a version has the version

111
00:07:22,860 --> 00:07:29,670
number at the very very end and if we look at the aliases for at the age and four aliases we can see

112
00:07:29,670 --> 00:07:36,290
that now there's death in the back and also prod in the back at the end of the E.R..

113
00:07:36,630 --> 00:07:41,970
So now we can point our functions not just two versions but also two aliases and have the aliases point

114
00:07:41,990 --> 00:07:44,790
to versions just the way we saw it in the slides from now.

115
00:07:45,680 --> 00:07:46,270
OK.

116
00:07:46,440 --> 00:07:47,530
So this is good right.

117
00:07:47,550 --> 00:07:49,400
But what if you won't you release a new version.

118
00:07:49,430 --> 00:07:54,800
So we're very happy with the way that is going and we want to promote diversion too into pride.

119
00:07:54,960 --> 00:08:00,360
So to do this I'm going to just call down and we can see here the alias configuration.

120
00:08:00,540 --> 00:08:05,430
So we are viewing the configuration for alias pride and we can manage a configuration for version 1

121
00:08:05,430 --> 00:08:07,630
if you click on that link but we'll stay here in this page.

122
00:08:07,950 --> 00:08:13,500
So proud is our most stable version for our lambda function and currently it is pointing to Version

123
00:08:13,500 --> 00:08:14,070
1.

124
00:08:14,220 --> 00:08:20,850
But maybe we want to also pointed to version two and we'll say that's 10 percent of the traffic should

125
00:08:20,850 --> 00:08:21,810
go to version 2.

126
00:08:22,320 --> 00:08:28,770
So now what we have is version 1 serving the 80 percent or 90 percent sorry of the traffic and version

127
00:08:28,770 --> 00:08:32,980
2 serving 10 percent of the traffic based on the weights we assigned.

128
00:08:33,180 --> 00:08:36,500
So this way we are doing some blue green testing.

129
00:08:36,500 --> 00:08:41,550
OK we're trying to see if the green versions or the newer version is working just fine.

130
00:08:41,940 --> 00:08:48,990
So I click on Save and now any time we invoke prod 90 percent of the time we'll have version 1 and 10

131
00:08:48,990 --> 00:08:50,790
percent of the time we'll have version 2.

132
00:08:51,030 --> 00:08:56,280
And if we're happy we can switch this all the way to 100 if we want to switch all the way you earned

133
00:08:56,280 --> 00:09:02,220
to right or we can just select version 2 in here and be done with it or we could say for example after

134
00:09:02,220 --> 00:09:04,520
10 percent I want to test a little bit more load.

135
00:09:04,590 --> 00:09:08,910
So I'm going to say 50 50 science or 50 loops I cannot enter 50.

136
00:09:09,510 --> 00:09:15,040
So I can enter the 5 and then the zero.

137
00:09:15,040 --> 00:09:16,240
Here we go.

138
00:09:16,240 --> 00:09:21,400
I mean we'll transfer 50 and so in here we have 50 50 of the weights and now 50 percent of the time

139
00:09:21,400 --> 00:09:25,680
version 1 will be invoked in 50 percent of the 2 of the time version 2 will be invoked.

140
00:09:25,720 --> 00:09:31,780
So let's say this and let's test our product click on Test and here we get how the world and I'll test

141
00:09:31,780 --> 00:09:32,290
again.

142
00:09:32,350 --> 00:09:33,850
We get good by world.

143
00:09:33,850 --> 00:09:34,890
So this is excellent.

144
00:09:34,900 --> 00:09:37,480
And in the log outputs we can see which version was invoked.

145
00:09:37,510 --> 00:09:39,010
So here it is version 2.

146
00:09:39,010 --> 00:09:43,600
But if I test again and a few times we should start seeing at some points of Hallowell.

147
00:09:43,600 --> 00:09:43,960
Here we go.

148
00:09:43,960 --> 00:09:44,660
Hello world.

149
00:09:44,740 --> 00:09:46,690
And then we have version 1.

150
00:09:46,900 --> 00:09:51,610
So here using these weights we're able to test the traffic to a new lambda version.

151
00:09:51,610 --> 00:09:57,280
And when we're ready to promote version 2 to prod it We'll click on version to click on Save and I'll

152
00:09:57,280 --> 00:10:00,730
set the weight to zero and I'll set additional version to none.

153
00:10:00,730 --> 00:10:01,240
Here we go.

154
00:10:01,450 --> 00:10:03,000
So we just have Version 2 in here.

155
00:10:03,000 --> 00:10:04,820
Now click on save.

156
00:10:04,900 --> 00:10:06,060
And now this has been saved.

157
00:10:06,070 --> 00:10:08,300
So proud is only pointing to version 2.

158
00:10:08,410 --> 00:10:15,490
And now if I invoke my function I only get good by Weld so using aliases we're able to use a bit more

159
00:10:15,550 --> 00:10:17,560
weight deployments for our Linda functions.

160
00:10:17,560 --> 00:10:19,100
And that's really really good.

161
00:10:19,150 --> 00:10:24,430
And does that remind you something maybe you've been burning for me to say it's for all along.

162
00:10:24,670 --> 00:10:26,300
And I hope it did remind you something.

163
00:10:26,380 --> 00:10:31,690
But remember we went to code deployed for lambda functions so we had our deployments configurations

164
00:10:32,050 --> 00:10:38,080
and for lambda so o filter for lambda we had all at once where we update dilemma function all at once.

165
00:10:38,230 --> 00:10:45,130
But we also had lambda linear 10 percent every 1 minutes and this actually under the hood is using this

166
00:10:45,130 --> 00:10:49,360
very same feature where we have percentage of weights in here.

167
00:10:49,360 --> 00:10:56,170
So this configuration of code deploy in here is actually adding 10 percent everyone minutes to this

168
00:10:56,170 --> 00:10:56,880
configuration.

169
00:10:57,430 --> 00:11:03,730
And here is lambda linear 10 percent every two minutes and so on and so linear remover means that we

170
00:11:03,730 --> 00:11:05,300
go and we start at 10.

171
00:11:05,350 --> 00:11:07,110
Then we'll be at 20.

172
00:11:07,240 --> 00:11:10,900
So 20 and then we'll be at 30 and so on.

173
00:11:10,900 --> 00:11:16,720
And when we have a Kennedy deployment which is here land that can every 10 percent 15 minutes.

174
00:11:16,870 --> 00:11:21,670
That means that we'll be at 10 for 15 minutes.

175
00:11:21,750 --> 00:11:27,490
And right after we'll be at 100 percent because it can every day appointments is a two step thing.

176
00:11:27,510 --> 00:11:27,750
Okay.

177
00:11:27,780 --> 00:11:29,490
Whereas linear is gradual.

178
00:11:29,550 --> 00:11:34,370
So super important you see this how could deploy configurations for the deployments.

179
00:11:34,470 --> 00:11:40,550
Do tie in to this feature of Alias and versions and something they want you draw your attention on.

180
00:11:40,710 --> 00:11:41,630
So that's it for this lecture.

181
00:11:41,640 --> 00:11:44,040
I hope you liked it and we'll see you in the next lecture.
