VersionOptions Struct
Options for lambda.Version.
Example
ts
const fn = new lambda.Function(this, 'MyFunction', {
currentVersionOptions: {
removalPolicy: RemovalPolicy.RETAIN, // retain old versions
retryAttempts: 1, // async retry attempts
},
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
});
fn.addAlias('live');
Properties
SHA256 of the version of the Lambda source code.
Default: No validation is performed
Specify to validate that you're deploying the right version.
Description of the version.
Default: Description of the Lambda
maxEventAgeDurationmax_event_ageDurationmaxEventAgeDurationMaxEventAgeDurationMaxEventAgeDuration= Duration.hours(6)#The maximum age of a request that Lambda sends to a function for processing.
Minimum: 60 seconds Maximum: 6 hours
maxExecutionEnvironmentsnumbermax_execution_environmentsint | floatmaxExecutionEnvironmentsNumberMaxExecutionEnvironmentsdoubleMaxExecutionEnvironments*float64#The maximum number of execution environments allowed for this version when published into a capacity provider.
Default: No maximum specified
This setting limits the total number of execution environments that can be created to handle concurrent invocations of this specific version.
minExecutionEnvironmentsnumbermin_execution_environmentsint | floatminExecutionEnvironmentsNumberMinExecutionEnvironmentsdoubleMinExecutionEnvironments*float64#The minimum number of execution environments to maintain for this version when published into a capacity provider.
Default: 3 execution environments are set to be the minimum
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.
onFailureIDestinationon_failureIDestinationonFailureIDestinationOnFailureIDestinationOnFailureIDestination#The destination for failed invocations.
Default: no destination
onSuccessIDestinationon_successIDestinationonSuccessIDestinationOnSuccessIDestinationOnSuccessIDestination#The destination for successful invocations.
Default: no destination
provisionedConcurrentExecutionsnumberprovisioned_concurrent_executionsint | floatprovisionedConcurrentExecutionsNumberProvisionedConcurrentExecutionsdoubleProvisionedConcurrentExecutions*float64#Specifies a provisioned concurrency configuration for a function's version.
Default: No provisioned concurrency
removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RemovalPolicy.DESTROY#Whether to retain old versions of this function when a new version is created.
retryAttemptsnumberretry_attemptsint | floatretryAttemptsNumberRetryAttemptsdoubleRetryAttempts*float64= 2#The maximum number of times to retry when the function returns an error.
Minimum: 0 Maximum: 2