DurableConfig

class aws_cdk.aws_lambda.DurableConfig(*, execution_timeout, retention_period=None)

Bases: object

Configuration for durable functions.

Lambda durable functions allow for long-running executions with persistent state.

Parameters:
  • execution_timeout (Duration) – The amount of time that Lambda allows a durable function to run before stopping it. Must be between 1 and 31,622,400 seconds (366 days).

  • retention_period (Optional[Duration]) – The number of days after a durable execution is closed that Lambda retains its history. Must be between 1 and 90 days. The underlying configuration is expressed in whole numbers of days. Providing a Duration that does not represent a whole number of days will result in a runtime or deployment error. Default: Duration.days(14)

ExampleMetadata:

infused

Example:

fn = lambda_.Function(self, "MyFunction",
    runtime=lambda_.Runtime.NODEJS_24_X,
    handler="index.handler",
    code=lambda_.Code.from_asset(path.join(__dirname, "lambda-handler")),
    durable_config=lambda.DurableConfig(execution_timeout=Duration.hours(1), retention_period=Duration.days(30))
)

Attributes

execution_timeout

The amount of time that Lambda allows a durable function to run before stopping it.

Must be between 1 and 31,622,400 seconds (366 days).

retention_period

The number of days after a durable execution is closed that Lambda retains its history.

Must be between 1 and 90 days.

The underlying configuration is expressed in whole numbers of days. Providing a Duration that does not represent a whole number of days will result in a runtime or deployment error.

Default:

Duration.days(14)