AliasOptions

class aws_cdk.aws_lambda.AliasOptions(*, max_event_age=None, on_failure=None, on_success=None, retry_attempts=None, additional_versions=None, description=None, provisioned_concurrent_executions=None)

Bases: EventInvokeConfigOptions

Options for lambda.Alias.

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 destination

  • on_success (Optional[IDestination]) – The destination for successful invocations. Default: - no destination

  • retry_attempts (Union[int, float, None]) – The maximum number of times to retry when the function returns an error. Minimum: 0 Maximum: 2 Default: 2

  • additional_versions (Optional[Sequence[Union[VersionWeight, Dict[str, Any]]]]) – Additional versions with individual weights this alias points to. Individual additional version weights specified here should add up to (less than) one. All remaining weight is routed to the default version. For example, the config is version: “1” additionalVersions: [{ version: “2”, weight: 0.05 }] Then 5% of traffic will be routed to function version 2, while the remaining 95% of traffic will be routed to function version 1. Default: No additional versions

  • description (Optional[str]) – Description for the alias. Default: No description

  • provisioned_concurrent_executions (Union[int, float, None]) – Specifies a provisioned concurrency configuration for a function’s alias. Default: No provisioned concurrency

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_lambda as lambda_

# destination: lambda.IDestination
# version: lambda.Version

alias_options = lambda.AliasOptions(
    additional_versions=[lambda.VersionWeight(
        version=version,
        weight=123
    )],
    description="description",
    max_event_age=cdk.Duration.minutes(30),
    on_failure=destination,
    on_success=destination,
    provisioned_concurrent_executions=123,
    retry_attempts=123
)

Attributes

additional_versions

Additional versions with individual weights this alias points to.

Individual additional version weights specified here should add up to (less than) one. All remaining weight is routed to the default version.

For example, the config is

version: “1” additionalVersions: [{ version: “2”, weight: 0.05 }]

Then 5% of traffic will be routed to function version 2, while the remaining 95% of traffic will be routed to function version 1.

Default:

No additional versions

description

Description for the alias.

Default:

No description

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)

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 alias.

Default:

No provisioned concurrency

retry_attempts

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

Minimum: 0 Maximum: 2

Default:

2