AliasProps

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

Bases: AliasOptions

Properties for a new 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 Example:: 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

  • alias_name (str) – Name of this alias.

  • version (IVersion) – Function version this alias refers to. Use lambda.currentVersion to reference a version with your latest changes.

ExampleMetadata:

infused

Example:

lambda_code = lambda_.Code.from_cfn_parameters()
func = lambda_.Function(self, "Lambda",
    code=lambda_code,
    handler="index.handler",
    runtime=lambda_.Runtime.NODEJS_14_X
)
# used to make sure each CDK synthesis produces a different Version
version = func.current_version
alias = lambda_.Alias(self, "LambdaAlias",
    alias_name="Prod",
    version=version
)

codedeploy.LambdaDeploymentGroup(self, "DeploymentGroup",
    alias=alias,
    deployment_config=codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE
)

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 Example:

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

alias_name

Name of this alias.

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

version

Function version this alias refers to.

Use lambda.currentVersion to reference a version with your latest changes.