# VersionProps

Properties for a new Lambda version.

Extends: VersionProps
Extends: VersionOptions
Used as props by: Version

- Source: [`aws-lambda/lib/lambda-version.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-lambda/lib/lambda-version.ts#L107)

## Example

```ts
declare const fn: lambda.Function;
const version = new lambda.Version(this, 'MyVersion', {
  lambda: fn,
});
```

## Properties

- `codeSha256`: string — 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`: string — Description of the version.

  **Default:** Description of the Lambda

- `lambda`: [IFunction](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IFunction.html) (required) — Function to get the value of.

- `maxEventAge`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.hours(6) — The maximum age of a request that Lambda sends to a function for processing.

  Minimum: 60 seconds
  Maximum: 6 hours

- `maxExecutionEnvironments`: number — 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.

- `minExecutionEnvironments`: number — 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.

- `onFailure`: [IDestination](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IDestination.html) — The destination for failed invocations.

  **Default:** no destination

- `onSuccess`: [IDestination](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IDestination.html) — The destination for successful invocations.

  **Default:** no destination

- `provisionedConcurrentExecutions`: number — Specifies a provisioned concurrency configuration for a function's version.

  **Default:** No provisioned concurrency

- `removalPolicy`: [RemovalPolicy](/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) = RemovalPolicy.DESTROY — Whether to retain old versions of this function when a new version is created.

- `retryAttempts`: number = 2 — The maximum number of times to retry when the function returns an error.

  Minimum: 0
  Maximum: 2
