@gradientedge/cdk-utils 8.52.0 → 8.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -116,7 +116,7 @@ class LambdaManager {
|
|
|
116
116
|
: undefined,
|
|
117
117
|
layers: layers,
|
|
118
118
|
logRetention: scope.props.logRetention ?? props.logRetention,
|
|
119
|
-
reservedConcurrentExecutions: props.reservedConcurrentExecutions ??
|
|
119
|
+
reservedConcurrentExecutions: props.reservedConcurrentExecutions ?? scope.props.defaultReservedLambdaConcurrentExecutions,
|
|
120
120
|
role: role instanceof iam.Role ? role : undefined,
|
|
121
121
|
securityGroups: securityGroups,
|
|
122
122
|
timeout: props.timeoutInSecs ? cdk.Duration.seconds(props.timeoutInSecs) : cdk.Duration.minutes(15),
|
|
@@ -126,6 +126,13 @@ class LambdaManager {
|
|
|
126
126
|
insightsVersion: props.insightsVersion,
|
|
127
127
|
},
|
|
128
128
|
});
|
|
129
|
+
if (props.provisionedConcurrency && props.lambdaAlias) {
|
|
130
|
+
const functionAlias = this.createLambdaFunctionAlias(`${id}-alias`, scope, props.lambdaAlias, lambdaFunction.currentVersion);
|
|
131
|
+
const functionAutoScaling = functionAlias.addAutoScaling(props.provisionedConcurrency);
|
|
132
|
+
functionAutoScaling.scaleOnUtilization({
|
|
133
|
+
utilizationTarget: props.provisionedConcurrency.utilizationTarget,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
129
136
|
if (props.tags && props.tags.length > 0) {
|
|
130
137
|
props.tags.forEach(tag => {
|
|
131
138
|
cdk.Tags.of(lambdaFunction).add(tag.key, tag.value);
|
|
@@ -55,6 +55,7 @@ export interface CommonStackProps extends cdk.StackProps {
|
|
|
55
55
|
stageContextPath?: string;
|
|
56
56
|
skipStageForARecords: boolean;
|
|
57
57
|
logRetention?: logs.RetentionDays;
|
|
58
|
+
defaultReservedLambdaConcurrentExecutions?: number;
|
|
58
59
|
excludeDomainNameForBuckets?: boolean;
|
|
59
60
|
nodejsRuntime?: lambda.Runtime;
|
|
60
61
|
}
|
|
@@ -700,6 +701,7 @@ export interface LambdaProps extends lambda.FunctionProps {
|
|
|
700
701
|
excludeLastModifiedTimestamp?: boolean;
|
|
701
702
|
tags?: TagProps[];
|
|
702
703
|
provisionedConcurrency?: ProvisionedConcurrencyProps;
|
|
704
|
+
lambdaAlias?: LambdaAliasProps;
|
|
703
705
|
}
|
|
704
706
|
/**
|
|
705
707
|
* @category cdk-utils.lambda-manager
|
package/package.json
CHANGED
|
@@ -118,7 +118,8 @@ export class LambdaManager {
|
|
|
118
118
|
: undefined,
|
|
119
119
|
layers: layers,
|
|
120
120
|
logRetention: scope.props.logRetention ?? props.logRetention,
|
|
121
|
-
reservedConcurrentExecutions:
|
|
121
|
+
reservedConcurrentExecutions:
|
|
122
|
+
props.reservedConcurrentExecutions ?? scope.props.defaultReservedLambdaConcurrentExecutions,
|
|
122
123
|
role: role instanceof iam.Role ? role : undefined,
|
|
123
124
|
securityGroups: securityGroups,
|
|
124
125
|
timeout: props.timeoutInSecs ? cdk.Duration.seconds(props.timeoutInSecs) : cdk.Duration.minutes(15),
|
|
@@ -129,6 +130,20 @@ export class LambdaManager {
|
|
|
129
130
|
},
|
|
130
131
|
})
|
|
131
132
|
|
|
133
|
+
if (props.provisionedConcurrency && props.lambdaAlias) {
|
|
134
|
+
const functionAlias = this.createLambdaFunctionAlias(
|
|
135
|
+
`${id}-alias`,
|
|
136
|
+
scope,
|
|
137
|
+
props.lambdaAlias,
|
|
138
|
+
lambdaFunction.currentVersion
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
const functionAutoScaling = functionAlias.addAutoScaling(props.provisionedConcurrency)
|
|
142
|
+
functionAutoScaling.scaleOnUtilization({
|
|
143
|
+
utilizationTarget: props.provisionedConcurrency.utilizationTarget,
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
|
|
132
147
|
if (props.tags && props.tags.length > 0) {
|
|
133
148
|
props.tags.forEach(tag => {
|
|
134
149
|
cdk.Tags.of(lambdaFunction).add(tag.key, tag.value)
|
|
@@ -57,6 +57,7 @@ export interface CommonStackProps extends cdk.StackProps {
|
|
|
57
57
|
stageContextPath?: string
|
|
58
58
|
skipStageForARecords: boolean
|
|
59
59
|
logRetention?: logs.RetentionDays
|
|
60
|
+
defaultReservedLambdaConcurrentExecutions?: number
|
|
60
61
|
excludeDomainNameForBuckets?: boolean
|
|
61
62
|
nodejsRuntime?: lambda.Runtime
|
|
62
63
|
}
|
|
@@ -749,6 +750,7 @@ export interface LambdaProps extends lambda.FunctionProps {
|
|
|
749
750
|
excludeLastModifiedTimestamp?: boolean
|
|
750
751
|
tags?: TagProps[]
|
|
751
752
|
provisionedConcurrency?: ProvisionedConcurrencyProps
|
|
753
|
+
lambdaAlias?: LambdaAliasProps
|
|
752
754
|
}
|
|
753
755
|
|
|
754
756
|
/**
|