‫So let's talk about the concepts
‫of Lambda Version and Aliases.
‫So far when we've been working on the Lambda functions,
‫we used this &LATEST version.
‫So this version was immutable
‫because we were able to edit our code and so on.
‫But one thing we haven't done is
‫that when we're happy with our code states,
‫we can publish the Lambda function
‫and create a new version.
‫So as soon as we hit publish,
‫it will become V1
‫and V1 is immutable.
‫What does immutable mean?
‫That means that you cannot change the code
‫or the environment variables,
‫or anything else afterwards.
‫So it is fixed as a version.
‫And so as you keep on publishing,
‫the versions will have an increasing version numbers.
‫So you go from V1 to V2,
‫et cetera.
‫Each version is independence
‫and will get its own ARN,
‫so Amazon Resource Name.
‫And so if we do know whatever it is now,
‫it is your code and your configuration.
‫Nothing can be changed.
‫It's immutable.
‫So each Lambda function version,
‫can be accessed as well as your latest.
‫So this is great to iterate
‫and mark your advance
‫until it releases you Lambda function.
‫But what if he wants to give
‫your end user a standard endpoint?
‫So for this, we can use Lambda Aliases.
‫Aliases are going to be pointers,
‫that points to your Lambda function versions.
‫And we can define a DEV test
‫and PROD Aliases.
‫For example and have them point
‫to different Lambda versions.
‫Aliases this time are mutable
‫and this is why we want to use them.
‫And so we have the latest,
‫which is a version in Alias,
‫This is fine.
‫Then with V1 and V2.
‫And so we're going to create a DEV Alias.
‫That's going to be mutable
‫pointing to the latest version of Lambda function.
‫This way we can edit code
‫and quickly see how it's going on.
‫In our users will interact with a DEV Alias
‫which will in turn call
‫the latest version of our function.
‫But we can create a TEST Alias
‫to test the V2 version of our function.
‫Again, that's mutable.
‫And we can create a PROD Alias
‫two test and not two test
‫actually two points to the V1 function
‫that we know is stable and working.
‫So why do we do Aliases
‫Well they enable canary deployments
‫Because we can assign weights
‫to the Lambda function versions we point to.
‫So for PROD for example,
‫say we want to switch
‫from the V1 function
‫all the way to the V2 function.
‫Instead of switching the pointer,
‫we can say 95% of the traffic
‫is going to go to V1.
‫And only 5% of the traffic is going to go to V2.
‫And the purpose of this
‫is that now we're testing V2 in PROD,
‫making sure it works
‫before we switch the full power
‫onto V2 and 100% of the traffic there.
‫So Aliases, enable stable configuration
‫for our triggers or user destinations.
‫They can be invoked stably,
‫but they can point in the backend
‫to whatever Lambda version we want.
‫So these Aliases will get their own ARNs.
‫And the great thing to note,
‫Aliases cannot reference
‫other Aliases.
‫They can only reference version
‫and it's something the exam may
‫try to trick you on.
‫Okay.
‫So let's go into the hands-on to see how they work.