interface AliasProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Lambda.AliasProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awslambda#AliasProps |
![]() | software.amazon.awscdk.services.lambda.AliasProps |
![]() | aws_cdk.aws_lambda.AliasProps |
![]() | 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_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
Name | Type | Description |
---|---|---|
alias | string | Name of this alias. |
version | IVersion | Function version this alias refers to. |
additional | Version [] | Additional versions with individual weights this alias points to. |
description? | string | Description for the alias. |
max | Duration | The maximum age of a request that Lambda sends to a function for processing. |
on | IDestination | The destination for failed invocations. |
on | IDestination | The destination for successful invocations. |
provisioned | number | Specifies a provisioned concurrency configuration for a function's alias. |
retry | number | The 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:
Version
[]
(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