interface VersionOptions
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Lambda.VersionOptions |
Java | software.amazon.awscdk.services.lambda.VersionOptions |
Python | aws_cdk.aws_lambda.VersionOptions |
TypeScript (source) | @aws-cdk/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_16_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
});
fn.addAlias('live');
Properties
Name | Type | Description |
---|---|---|
code | string | SHA256 of the version of the Lambda source code. |
description? | string | Description of the version. |
max | Duration | The maximum age of a request that Lambda sends to a function for processing. |
on | IDestination | The destination for failed invocations. |
on | IDestination | The destination for successful invocations. |
provisioned | number | Specifies a provisioned concurrency configuration for a function's version. |
removal | Removal | Whether to retain old versions of this function when a new version is created. |
retry | number | The 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:
Removal
(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