AWS Lambda
Developer Guide

AWS Lambda Function Versioning and Aliases

Versioning allows you to better manage your in-production Lambda function code by enabling you to publish one or more versions of your Lambda function. As a result, you can work with different variations of your Lambda function in your development workflow, such as development, beta, and production. Each Lambda function version has a unique Amazon Resource Name (ARN). After you publish a version, it is immutable (that is, it can't be changed).

AWS Lambda supports creating aliases for each of your Lambda function versions. Conceptually, an AWS Lambda alias is a pointer to a specific Lambda function version, but it is also a resource similar to a Lambda function, and each alias has a unique ARN. Each alias maintains an ARN for a function version to which it points (note that an alias can only point to a function version, not to another alias). Unlike versions, which are immutable, aliases are mutable (that is, they can be changed) and can be updated to point to different versions

The following example shows two versions of a helloworld Lambda function (version $LATEST, and version 1). Each of these function versions has an alias (DEV and PROD) pointing to it.

Aliases enable you to abstract the process of promoting new Lambda function versions into production from the mapping of the Lambda function version and its event source. For more information, see How It Works.

For example, suppose Amazon S3 is the event source that invokes your Lambda function when new objects are created in a bucket. When Amazon S3 is your event source, you store the event source mapping information in the bucket notification configuration. In the configuration you can identify the Lambda function ARN that Amazon S3 can invoke, but, in this case, each time you publish a new version of your Lambda function you need to update the notification configuration so that Amazon S3 invokes the correct version. Instead of specifying the function ARN, you can specify an alias ARN in the notification configuration (for example, PROD alias ARN). As you promote new versions of your Lambda function into production, you only need to update the PROD alias to point to the latest stable version, and you don't need to update the notification configuration in Amazon S3.

The same applies when you need to roll back to a previous version of your Lambda function. In this scenario, you just update the PROD alias to point to a different function version, and there is no need to update event source mappings.

We recommend you use versioning and aliases to deploy your Lambda functions when building applications with multiple dependencies and developers involved.

For detailed information, see the following topics: