AWS CloudFormation
User Guide (Version )


The AWS::Lambda::Version resource creates a version from the current code and configuration of a function. Use versions to create a snapshot of your function code and configuration that doesn't change.


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


{ "Type" : "AWS::Lambda::Version", "Properties" : { "CodeSha256" : String, "Description" : String, "FunctionName" : String } }


Type: AWS::Lambda::Version Properties: CodeSha256: String Description: String FunctionName: String



Only publish a version if the hash value matches the value that's specified. Use this option to avoid publishing a version if the function code has changed since you last updated it.

Required: No

Type: String

Update requires: No interruption


A description for the version to override the description in the function configuration.

Required: No

Type: String

Minimum: 0

Maximum: 256

Update requires: No interruption


The name of the Lambda function.

Name formats

  • Function name - MyFunction.

  • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.

  • Partial ARN - 123456789012:function:MyFunction.

The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

Required: Yes

Type: String

Minimum: 1

Maximum: 140

Pattern: (arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]{2}(-gov)?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?

Update requires: Replacement

Return Values


When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the ARN of the version, such as arn:aws:lambda:us-west-2:123456789012:function:helloworld:1.

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


The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.


The version number.


Function Version

Create a version of function MyFunction.


"MyVersion": { "Type": "AWS::Lambda::Version", "Properties": { "FunctionName": { "Ref": "MyFunction" }, "Description": "A test version of MyFunction" } }


MyVersion: Type: AWS::Lambda::Version Properties: FunctionName: Ref: "MyFunction" Description: "A test version of MyFunction"