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
codeSha256stringcode_sha256strcodeSha256StringCodeSha256stringCodeSha256*string= No validation is performed#SHA256 of the version of the Lambda source code.
Specify to validate that you're deploying the right version.
descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string= Description of the Lambda#Description of the version.
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= No maximum specified#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.
minExecutionEnvironmentsnumbermin_execution_environmentsint | floatminExecutionEnvironmentsNumberMinExecutionEnvironmentsdoubleMinExecutionEnvironments*float64= 3 execution environments are set…#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
Default: 3 execution environments are set to be the minimum
onFailureIDestinationon_failureIDestinationonFailureIDestinationOnFailureIDestinationOnFailureIDestination= no destination#The destination for failed invocations.
onSuccessIDestinationon_successIDestinationonSuccessIDestinationOnSuccessIDestinationOnSuccessIDestination= no destination#The destination for successful invocations.
provisionedConcurrentExecutionsnumberprovisioned_concurrent_executionsint | floatprovisionedConcurrentExecutionsNumberProvisionedConcurrentExecutionsdoubleProvisionedConcurrentExecutions*float64= No provisioned concurrency#Specifies a provisioned concurrency configuration for a function's version.
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