aws-cdk-lib.aws_lambda.AliasProps

interface AliasProps

LanguageType name
.NETAmazon.CDK.AWS.Lambda.AliasProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslambda#AliasProps
Javasoftware.amazon.awscdk.services.lambda.AliasProps
Pythonaws_cdk.aws_lambda.AliasProps
TypeScript (source)aws-cdk-lib » aws_lambda » AliasProps

Properties for a new Lambda alias.

Example

const lambdaCode = lambda.Code.fromCfnParameters();
const func = new lambda.Function(this, 'Lambda', {
  code: lambdaCode,
  handler: 'index.handler',
  runtime: lambda.Runtime.NODEJS_14_X,
});
// used to make sure each CDK synthesis produces a different Version
const version = func.currentVersion;
const alias = new lambda.Alias(this, 'LambdaAlias', {
  aliasName: 'Prod',
  version,
});

new codedeploy.LambdaDeploymentGroup(this, 'DeploymentGroup', {
  alias,
  deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE,
});

Properties

NameTypeDescription
aliasNamestringName of this alias.
versionIVersionFunction version this alias refers to.
additionalVersions?VersionWeight[]Additional versions with individual weights this alias points to.
description?stringDescription for the alias.
maxEventAge?DurationThe maximum age of a request that Lambda sends to a function for processing.
onFailure?IDestinationThe destination for failed invocations.
onSuccess?IDestinationThe destination for successful invocations.
provisionedConcurrentExecutions?numberSpecifies a provisioned concurrency configuration for a function's alias.
retryAttempts?numberThe maximum number of times to retry when the function returns an error.

aliasName

Type: string

Name of this alias.


version

Type: IVersion

Function version this alias refers to.

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


additionalVersions?

Type: VersionWeight[] (optional, default: No 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.


description?

Type: string (optional, default: No description)

Description for the alias.


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


retryAttempts?

Type: number (optional, default: 2)

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

Minimum: 0 Maximum: 2