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

AWS::Lambda::Version

The AWS::Lambda::Version resource publishes a specified version of an AWS Lambda (Lambda) function. When publishing a new version of your function, Lambda copies the latest version of your function. For more information, see Introduction to AWS Lambda Versioning 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::Version", "Properties" : { "CodeSha256" : String, "Description" : String, "FunctionName" : String } }

YAML

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

Properties

CodeSha256

The SHA-256 hash of the deployment package that you want to publish. This value must match the SHA-256 hash of the $LATEST version of the function. Specify this property to validate that you are publishing the correct package.

Required: No

Type: String

Update requires: Updates are not supported.

Description

A description of the version you are publishing. If you don't specify a value, Lambda copies the description from the $LATEST version of the function.

Required: No

Type: String

Update requires: Updates are not supported.

FunctionName

The Lambda function for which you want to publish a version. You can specify the function's name or its Amazon Resource Name (ARN).

Required: Yes

Type: String

Update requires: Replacement

Return Values

Ref

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

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

Fn::GetAtt

Fn::GetAtt returns a value for a specified attribute of the specified resource type.

Version

The published version of a Lambda version, such as 1.

For more information about using Fn::GetAtt, see Fn::GetAtt.

Example

The following example publishes a new version of the MyFunction Lambda function.

JSON

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

YAML

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