# VersionProps

Properties for a new Lambda version.

Extends: [VersionOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.VersionOptions.html)
Used as props by: [Version](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Version.html)

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

## Example

TypeScript:

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

Python:

```python
# fn: lambda.Function

version = lambda_.Version(self, "MyVersion",
    lambda_=fn
)
```

Java:

```java
Function fn;

Version version = Version.Builder.create(this, "MyVersion")
        .lambda(fn)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Function fn;

var version = new Version(this, "MyVersion", new VersionProps {
    Lambda = fn
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var fn Function

version := lambda.NewVersion(this, jsii.String("MyVersion"), &VersionProps{
	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
