Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::Lambda::Alias

The AWS::Lambda::Alias resource creates an alias that points to the version of an AWS Lambda (Lambda) function that you specify. Use aliases when you want to control which version of your function other services or applications invoke. Those services or applications can use your function's alias so that they don't need to be updated whenever you release a new version of your function. For more information, see Introduction to AWS Lambda Aliases in the AWS Lambda Developer Guide.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

Copy
{ "Type" : "AWS::Lambda::Alias", "Properties" : { "Description" : String, "FunctionName" : String, "FunctionVersion" : String, "Name" : String } }

YAML

Copy
Type: "AWS::Lambda::Alias" Properties: Description: String FunctionName: String FunctionVersion: String Name: String

Properties

Description

Information about the alias, such as its purpose or the Lambda function that is associated with it.

Required: No

Type: String

Update requires: No interruption

FunctionName

The Lambda function that you want to associate with this alias. You can specify the function's name or its Amazon Resource Name (ARN).

Required: Yes

Type: String

Update requires: Replacement

FunctionVersion

The version of the Lambda function that you want to associate with this alias.

Required: Yes

Type: String

Update requires: No interruption

Name

A name for the alias.

Required: Yes

Type: String

Update requires: Replacement

Return Value

Ref

When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the ARN of the Lambda alias.

For more information about using the Ref function, see Ref.

Examples

The following examples create an alias named TestingForMyApp. The alias points to the TestingNewFeature version of the MyFunction Lambda function.

JSON

Copy
"AliasForMyApp" : { "Type" : "AWS::Lambda::Alias", "Properties" : { "FunctionName" : { "Ref" : "MyFunction" }, "FunctionVersion" : { "Fn::GetAtt" : [ "TestingNewFeature", "Version" ] }, "Name" : "TestingForMyApp" } }

YAML

Copy
AliasForMyApp: Type: "AWS::Lambda::Alias" Properties: FunctionName: Ref: "MyFunction" FunctionVersion: Fn::GetAtt: - "TestingNewFeature" - "Version" Name: "TestingForMyApp"