Skip to content
v2.273.0

AliasProps Struct ​

Properties for a new Lambda alias.

Example ​

ts
const lambdaCode = lambda.Code.fromCfnParameters();
const func = new lambda.Function(this, 'Lambda', {
  code: lambdaCode,
  handler: 'index.handler',
  runtime: lambda.Runtime.NODEJS_LATEST,
});
// 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 ​

additionalVersionsVersionWeight[]additional_versionstyping.List[VersionWeight]additionalVersionsList<VersionWeight>AdditionalVersionsVersionWeight[]AdditionalVersions*[]VersionWeight= No additional versions#
Additional versions with individual weights this alias points to.
notes

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.

aliasNamestringalias_namestraliasNameStringAliasNamestringAliasName*stringrequired#
Name of this alias.
descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string= No description#
Description for the alias.
maxEventAgeDurationmax_event_ageDurationmaxEventAgeDurationMaxEventAgeDurationMaxEventAgeDuration= Duration.hours(6)#
The maximum age of a request that Lambda sends to a function for processing.

Minimum: 60 seconds Maximum: 6 hours

onFailureIDestinationon_failureIDestinationonFailureIDestinationOnFailureIDestinationOnFailureIDestination= no destination#
The destination for failed invocations.
onSuccessIDestinationon_successIDestinationonSuccessIDestinationOnSuccessIDestinationOnSuccessIDestination= no destination#
The destination for successful invocations.
provisionedConcurrentExecutionsnumberprovisioned_concurrent_executionsint | floatprovisionedConcurrentExecutionsNumberProvisionedConcurrentExecutionsdoubleProvisionedConcurrentExecutions*float64= No provisioned concurrency#
Specifies a provisioned concurrency configuration for a function's alias.
retryAttemptsnumberretry_attemptsint | floatretryAttemptsNumberRetryAttemptsdoubleRetryAttempts*float64= 2#
The maximum number of times to retry when the function returns an error.

Minimum: 0 Maximum: 2

versionIVersionversionIVersionversionIVersionVersionIVersionVersionIVersionrequired#
Function version this alias refers to.

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

Used as props by ​