AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

Version

Tag the current state of a Function with a Version number. Avoid using this resource directly. If you need a Version object, use `function.currentVersion` instead. That will add a Version object to your template, and make sure the Version is invalidated whenever the Function object changes. If you use the `Version` resource directly, you are responsible for making sure it is invalidated (by changing its logical ID) whenever necessary. Version resources can then be used in `Alias` resources to refer to a particular deployment of a Lambda. If you want to ensure that you're associating the right version with the right deployment, specify the `codeSha256` property while creating the `Version.

Import

import { Version } from 'aws-cdk-lib/aws-lambda';

Or use the module namespace:

import * as lambda from 'aws-cdk-lib/aws-lambda';
// lambda.Version

Properties

Configuration passed to the constructor as VersionProps.

lambdaRequired
IFunction

Function to get the value of.

6 properties inherited from VersionOptions
codeSha256Optionalinherited from VersionOptions
string

SHA256 of the version of the Lambda source code. Specify to validate that you're deploying the right version.

Default: No validation is performed

descriptionOptionalinherited from VersionOptions
string

Description of the version.

Default: Description of the Lambda

maxExecutionEnvironmentsOptionalinherited from VersionOptions
number

The maximum number of execution environments allowed for this version when published into a capacity provider. This setting limits the total number of execution environments that can be created to handle concurrent invocations of this specific version.

Default: - No maximum specified

minExecutionEnvironmentsOptionalinherited from VersionOptions
number

The minimum number of execution environments to maintain for this version when published into a capacity provider. This setting ensures that at least this many execution environments are always available to handle function invocations for this specific version, reducing cold start latency.

Default: - 3 execution environments are set to be the minimum

provisionedConcurrentExecutionsOptionalinherited from VersionOptions
number

Specifies a provisioned concurrency configuration for a function's version.

Default: No provisioned concurrency

removalPolicyOptionalinherited from VersionOptions
RemovalPolicy

Whether to retain old versions of this function when a new version is created.

Default: RemovalPolicy.DESTROY

4 properties inherited from EventInvokeConfigOptions
maxEventAgeOptionalinherited from EventInvokeConfigOptions
Duration

The maximum age of a request that Lambda sends to a function for processing. Minimum: 60 seconds Maximum: 6 hours

Default: Duration.hours(6)

onFailureOptionalinherited from EventInvokeConfigOptions
IDestination

The destination for failed invocations.

Default: - no destination

onSuccessOptionalinherited from EventInvokeConfigOptions
IDestination

The destination for successful invocations.

Default: - no destination

retryAttemptsOptionalinherited from EventInvokeConfigOptions
number

The maximum number of times to retry when the function returns an error. Minimum: 0 Maximum: 2

Default: 2

Get the AWS Lambda Cheat Sheet

Everything you need to know about AWS Lambda on one page. HD quality, print-friendly.

Download Free Infographic