View a markdown version of this page

AWS::Lambda::WebFunctionRevision - AWS CloudFormation

This is the new CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the AWS CloudFormation User Guide.

AWS::Lambda::WebFunctionRevision

The AWS::Lambda::WebFunctionRevision resource creates an immutable revision for a Lambda web function. A revision represents a specific version of the function's code and configuration. You can't modify a revision after you create it. You also can't delete a revision that is currently serving traffic on an endpoint. To route traffic to a revision, reference it from the RevisionWeights property of an AWS::Lambda::WebFunctionEndpoint resource.

Syntax

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

JSON

{ "Type" : "AWS::Lambda::WebFunctionRevision", "Properties" : { "BuildConfig" : BuildConfig, "Description" : String, "FunctionName" : String, "KmsKeyArn" : String, "ServiceConfig" : ServiceConfig } }

YAML

Type: AWS::Lambda::WebFunctionRevision Properties: BuildConfig: BuildConfig Description: String FunctionName: String KmsKeyArn: String ServiceConfig: ServiceConfig

Properties

BuildConfig

The build configuration for the revision, including code location and runtime settings.

Required: Yes

Type: BuildConfig

Update requires: Replacement

Description

A description of the revision.

Required: No

Type: String

Minimum: 0

Maximum: 256

Update requires: Replacement

FunctionName

The web function.

You can specify either of the following:

  • The function name, for example my-function.

  • The function ARN, for example arn:aws:lambda:us-east-1:111122223333:web-function/my-function.

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: 256

Update requires: Replacement

KmsKeyArn

The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) key used to encrypt the revision's code and environment variables.

Required: No

Type: String

Pattern: ^arn:(aws[a-z-]*){1}:kms:[a-z0-9-]+:[0-9]{12}:key/.*$

Minimum: 20

Maximum: 2048

Update requires: Replacement

ServiceConfig

The service configuration for the revision, including execution role, timeout, and concurrency settings.

Required: Yes

Type: ServiceConfig

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the Amazon Resource Name (ARN) of the revision.

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.

CreatedAt

The date and time the revision was created.

FunctionArn

The Amazon Resource Name (ARN) of the web function.

RevisionArn

The Amazon Resource Name (ARN) of the revision.

RevisionId

The identifier of the revision.

State

The current state of the revision.

StateReason

The reason for the current state of the revision.

Examples

Web function revision

Create a revision for the web function my-web-function from a deployment package in Amazon S3.

JSON

"MyRevision": { "Type": "AWS::Lambda::WebFunctionRevision", "Properties": { "FunctionName": "my-web-function", "Description": "First revision", "BuildConfig": { "CodeConfig": { "S3Object": { "Bucket": "amzn-s3-demo-bucket", "Key": "app.zip" } }, "RuntimeConfig": { "Runtime": "nodejs24.x" } }, "ServiceConfig": { "ExecutionRoleArn": { "Fn::GetAtt": [ "MyExecutionRole", "Arn" ] }, "TimeoutSeconds": 30 } } }

YAML

MyRevision: Type: AWS::Lambda::WebFunctionRevision Properties: FunctionName: my-web-function Description: First revision BuildConfig: CodeConfig: S3Object: Bucket: amzn-s3-demo-bucket Key: app.zip RuntimeConfig: Runtime: nodejs24.x ServiceConfig: ExecutionRoleArn: !GetAtt MyExecutionRole.Arn TimeoutSeconds: 30