VersionOptions
- class aws_cdk.aws_lambda.VersionOptions(*, max_event_age=None, on_failure=None, on_success=None, retry_attempts=None, code_sha256=None, description=None, max_execution_environments=None, min_execution_environments=None, provisioned_concurrent_executions=None, removal_policy=None)
Bases:
EventInvokeConfigOptionsOptions for
lambda.Version.- Parameters:
max_event_age (
Optional[Duration]) – The maximum age of a request that Lambda sends to a function for processing. Minimum: 60 seconds Maximum: 6 hours Default: Duration.hours(6)on_failure (
Optional[IDestination]) – The destination for failed invocations. Default: - no destinationon_success (
Optional[IDestination]) – The destination for successful invocations. Default: - no destinationretry_attempts (
Union[int,float,None]) – The maximum number of times to retry when the function returns an error. Minimum: 0 Maximum: 2 Default: 2code_sha256 (
Optional[str]) – SHA256 of the version of the Lambda source code. Specify to validate that you’re deploying the right version. Default: No validation is performeddescription (
Optional[str]) – Description of the version. Default: Description of the Lambdamax_execution_environments (
Union[int,float,None]) – 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. Default: - No maximum specifiedmin_execution_environments (
Union[int,float,None]) – 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: - 3 execution environments are set to be the minimumprovisioned_concurrent_executions (
Union[int,float,None]) – Specifies a provisioned concurrency configuration for a function’s version. Default: No provisioned concurrencyremoval_policy (
Optional[RemovalPolicy]) – Whether to retain old versions of this function when a new version is created. Default: RemovalPolicy.DESTROY
- ExampleMetadata:
infused
Example:
fn = lambda_.Function(self, "MyFunction", current_version_options=lambda.VersionOptions( removal_policy=RemovalPolicy.RETAIN, # retain old versions retry_attempts=1 ), runtime=lambda_.Runtime.NODEJS_18_X, handler="index.handler", code=lambda_.Code.from_asset(path.join(__dirname, "lambda-handler")) ) fn.add_alias("live")
Attributes
- code_sha256
SHA256 of the version of the Lambda source code.
Specify to validate that you’re deploying the right version.
- Default:
No validation is performed
- description
Description of the version.
- Default:
Description of the Lambda
- max_event_age
The maximum age of a request that Lambda sends to a function for processing.
Minimum: 60 seconds Maximum: 6 hours
- Default:
Duration.hours(6)
- max_execution_environments
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.
- Default:
No maximum specified
- min_execution_environments
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:
3 execution environments are set to be the minimum
- on_failure
The destination for failed invocations.
- Default:
no destination
- on_success
The destination for successful invocations.
- Default:
no destination
- provisioned_concurrent_executions
Specifies a provisioned concurrency configuration for a function’s version.
- Default:
No provisioned concurrency
- removal_policy
Whether to retain old versions of this function when a new version is created.
- Default:
RemovalPolicy.DESTROY
- retry_attempts
The maximum number of times to retry when the function returns an error.
Minimum: 0 Maximum: 2
- Default:
2