Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

AWS::Lambda::Version

Focus mode
AWS::Lambda::Version - AWS CloudFormation
Filter View

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.

Syntax

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

JSON

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

Properties

CodeSha256

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. Updates are not supported for this property.

Required: No

Type: String

Update requires: Replacement

Description

A description for the version to override the description in the function configuration. Updates are not supported for this property.

Required: No

Type: String

Minimum: 0

Maximum: 256

Update requires: Replacement

FunctionName

The name or ARN 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

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

Minimum: 1

Maximum: 140

Update requires: Replacement

ProvisionedConcurrencyConfig

Specifies a provisioned concurrency configuration for a function's version. Updates are not supported for this property.

Required: No

Type: ProvisionedConcurrencyConfiguration

Update requires: Replacement

RuntimePolicy

Property description not available.

Required: No

Type: RuntimePolicy

Update requires: Replacement

Return values

Ref

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-east-2:123456789012:function:helloworld:1.

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

Fn::GetAtt

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.

FunctionArn

The ARN of the function.

Version

The version number.

Examples

Function Version

Publish a version with provisioned concurrency.

YAML

Resources: function: Type: AWS::Lambda::Function Properties: Handler: index.handler Role: arn:aws:iam::123456789012:role/lambda-role Code: ZipFile: | exports.handler = async (event) => { console.log(JSON.stringify(event, null, 2)); const response = { statusCode: 200, body: JSON.stringify('Hello from Lambda!'), }; return response; }; Runtime: nodejs18.x TracingConfig: Mode: Active version: Type: AWS::Lambda::Version Properties: FunctionName: !Ref function Description: v1 ProvisionedConcurrencyConfig: ProvisionedConcurrentExecutions: 20

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.