@gradientedge/cdk-utils 8.51.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
|
}
|
|
@@ -680,6 +681,15 @@ export interface TagProps {
|
|
|
680
681
|
key: string;
|
|
681
682
|
value: string;
|
|
682
683
|
}
|
|
684
|
+
/**
|
|
685
|
+
* @category cdk-utils.lambda-manager
|
|
686
|
+
* @subcategory Properties
|
|
687
|
+
*/
|
|
688
|
+
export interface ProvisionedConcurrencyProps {
|
|
689
|
+
minCapacity: number;
|
|
690
|
+
maxCapacity: number;
|
|
691
|
+
utilizationTarget: number;
|
|
692
|
+
}
|
|
683
693
|
/**
|
|
684
694
|
* @category cdk-utils.lambda-manager
|
|
685
695
|
* @subcategory Properties
|
|
@@ -690,6 +700,8 @@ export interface LambdaProps extends lambda.FunctionProps {
|
|
|
690
700
|
timeoutInSecs?: number;
|
|
691
701
|
excludeLastModifiedTimestamp?: boolean;
|
|
692
702
|
tags?: TagProps[];
|
|
703
|
+
provisionedConcurrency?: ProvisionedConcurrencyProps;
|
|
704
|
+
lambdaAlias?: LambdaAliasProps;
|
|
693
705
|
}
|
|
694
706
|
/**
|
|
695
707
|
* @category cdk-utils.lambda-manager
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.53.0",
|
|
4
4
|
"description": "Utilities for AWS CDK provisioning",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@types/lodash": "^4.14.194",
|
|
49
|
-
"@types/node": "^
|
|
49
|
+
"@types/node": "^20.1.1",
|
|
50
50
|
"app-root-path": "^3.1.0",
|
|
51
51
|
"aws-cdk-lib": "^2.78.0",
|
|
52
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
53
|
-
"constructs": "^10.2.
|
|
52
|
+
"@aws-sdk/client-secrets-manager": "^3.329.0",
|
|
53
|
+
"constructs": "^10.2.17",
|
|
54
54
|
"lodash": "^4.17.21",
|
|
55
55
|
"moment": "^2.29.4",
|
|
56
56
|
"nconf": "^0.12.0",
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"@babel/eslint-parser": "^7.21.8",
|
|
63
63
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
64
64
|
"@types/jest": "^29.5.1",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^5.59.
|
|
66
|
-
"@typescript-eslint/parser": "^5.59.
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
|
66
|
+
"@typescript-eslint/parser": "^5.59.5",
|
|
67
67
|
"aws-cdk": "^2.78.0",
|
|
68
68
|
"better-docs": "^2.7.2",
|
|
69
69
|
"codecov": "^3.8.3",
|
|
70
70
|
"commitizen": "^4.3.0",
|
|
71
71
|
"dotenv": "^16.0.3",
|
|
72
|
-
"eslint": "^8.
|
|
72
|
+
"eslint": "^8.40.0",
|
|
73
73
|
"eslint-config-prettier": "^8.8.0",
|
|
74
74
|
"eslint-plugin-import": "^2.27.5",
|
|
75
75
|
"husky": "^8.0.3",
|
|
@@ -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
|
}
|
|
@@ -728,6 +729,16 @@ export interface TagProps {
|
|
|
728
729
|
value: string
|
|
729
730
|
}
|
|
730
731
|
|
|
732
|
+
/**
|
|
733
|
+
* @category cdk-utils.lambda-manager
|
|
734
|
+
* @subcategory Properties
|
|
735
|
+
*/
|
|
736
|
+
export interface ProvisionedConcurrencyProps {
|
|
737
|
+
minCapacity: number
|
|
738
|
+
maxCapacity: number
|
|
739
|
+
utilizationTarget: number
|
|
740
|
+
}
|
|
741
|
+
|
|
731
742
|
/**
|
|
732
743
|
* @category cdk-utils.lambda-manager
|
|
733
744
|
* @subcategory Properties
|
|
@@ -738,6 +749,8 @@ export interface LambdaProps extends lambda.FunctionProps {
|
|
|
738
749
|
timeoutInSecs?: number
|
|
739
750
|
excludeLastModifiedTimestamp?: boolean
|
|
740
751
|
tags?: TagProps[]
|
|
752
|
+
provisionedConcurrency?: ProvisionedConcurrencyProps
|
|
753
|
+
lambdaAlias?: LambdaAliasProps
|
|
741
754
|
}
|
|
742
755
|
|
|
743
756
|
/**
|