aws-cdk-lib.aws_lambda.VersionOptions

interface VersionOptions

LanguageType name
.NETAmazon.CDK.AWS.Lambda.VersionOptions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslambda#VersionOptions
Javasoftware.amazon.awscdk.services.lambda.VersionOptions
Pythonaws_cdk.aws_lambda.VersionOptions
TypeScript (source)aws-cdk-lib » aws_lambda » VersionOptions

Options for lambda.Version.

Example

const fn = new lambda.Function(this, 'MyFunction', {
  currentVersionOptions: {
    removalPolicy: RemovalPolicy.RETAIN, // retain old versions
    retryAttempts: 1,                   // async retry attempts
  },
  runtime: lambda.Runtime.NODEJS_18_X,
  handler: 'index.handler',
  code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
});

fn.addAlias('live');

Properties

NameTypeDescription
codeSha256?stringSHA256 of the version of the Lambda source code.
description?stringDescription of the version.
maxEventAge?DurationThe maximum age of a request that Lambda sends to a function for processing.
onFailure?IDestinationThe destination for failed invocations.
onSuccess?IDestinationThe destination for successful invocations.
provisionedConcurrentExecutions?numberSpecifies a provisioned concurrency configuration for a function's version.
removalPolicy?RemovalPolicyWhether to retain old versions of this function when a new version is created.
retryAttempts?numberThe maximum number of times to retry when the function returns an error.

codeSha256?

Type: string (optional, default: No validation is performed)

SHA256 of the version of the Lambda source code.

Specify to validate that you're deploying the right version.


description?

Type: string (optional, default: Description of the Lambda)

Description of the version.


maxEventAge?

Type: Duration (optional, default: Duration.hours(6))

The maximum age of a request that Lambda sends to a function for processing.

Minimum: 60 seconds Maximum: 6 hours


onFailure?

Type: IDestination (optional, default: no destination)

The destination for failed invocations.


onSuccess?

Type: IDestination (optional, default: no destination)

The destination for successful invocations.


provisionedConcurrentExecutions?

Type: number (optional, default: No provisioned concurrency)

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


removalPolicy?

Type: RemovalPolicy (optional, default: RemovalPolicy.DESTROY)

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


retryAttempts?

Type: number (optional, default: 2)

The maximum number of times to retry when the function returns an error.

Minimum: 0 Maximum: 2