Skip to content

Version Control with Lambda

Versioning

When you use versioning in AWS Lambda, you can 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 Lamda 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 maintains your latest function code in the $LATEST version. When you update your function code, AWS Lambda replaces the code in the $LATEST version of the Lambda function.

Qualified/Unqualified ARNs

You can refer to this function using its ARN. There are two ARNs associated with this initial version:

  1. Qualified ARN - The Function ARN with the version suffix (e.g. arn:aws:lambda:aws-region:acct-id:function:hellowrld:$LATEST)
  2. Unqualified ARN - The function ARN without the version suffix (e.g. arn:aws:lambda:aws-region:acct-id:function:helloworld)

Alias

After initially creating a Lambda function (the $LATEST version), you can publish a version 1 of it. By creating an alias named PROD that points to version 1, you can now use the PROD alias to invoke version 1 of the Lambda function.

Now, you can update the code (the $LATEST version) with all of your improvements, and then publish another stable and improved version (version 2). You can promote version 2 to production by remapping the PROD alias so that it points to version 2. If you find something wrong, you can easily roll back the production version to version 1 by remapping the PROD alias so that it points to version 1.