@gradientedge/cdk-utils 8.91.0 → 8.92.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.
- package/.eslintrc.json +40 -0
- package/app/api-destined-function/src/lib/lambda.ts +6 -6
- package/dist/app/api-destined-function/src/lib/lambda.d.ts +6 -6
- package/dist/app/api-destined-function/src/lib/lambda.js +6 -6
- package/dist/lib/lambda.d.ts +6 -6
- package/dist/lib/lambda.js +6 -6
- package/dist/lib/lambda.js.map +1 -1
- package/dist/src/lib/common/construct.d.ts +4 -7
- package/dist/src/lib/common/construct.js +4 -7
- package/dist/src/lib/common/stack.d.ts +9 -13
- package/dist/src/lib/common/stack.js +9 -13
- package/dist/src/lib/common/types.d.ts +0 -2
- package/dist/src/lib/construct/api-to-eventbridge-target/api.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/api.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/event.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/event.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +0 -27
- package/dist/src/lib/construct/api-to-eventbridge-target/main.js +41 -68
- package/dist/src/lib/construct/api-to-eventbridge-target/types.d.ts +13 -25
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +0 -37
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +44 -81
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/types.d.ts +1 -5
- package/dist/src/lib/construct/api-to-lambda-target/api.d.ts +0 -3
- package/dist/src/lib/construct/api-to-lambda-target/api.js +0 -3
- package/dist/src/lib/construct/api-to-lambda-target/main.d.ts +0 -14
- package/dist/src/lib/construct/api-to-lambda-target/main.js +7 -21
- package/dist/src/lib/construct/api-to-lambda-target/types.d.ts +7 -13
- package/dist/src/lib/construct/graphql-api-lambda/main.d.ts +0 -18
- package/dist/src/lib/construct/graphql-api-lambda/main.js +1 -19
- package/dist/src/lib/construct/graphql-api-lambda/types.d.ts +4 -8
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.d.ts +0 -11
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.js +1 -12
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/types.d.ts +1 -3
- package/dist/src/lib/construct/lambda-with-iam-access/main.d.ts +0 -12
- package/dist/src/lib/construct/lambda-with-iam-access/main.js +2 -14
- package/dist/src/lib/construct/rest-api-lambda/main.d.ts +0 -18
- package/dist/src/lib/construct/rest-api-lambda/main.js +1 -19
- package/dist/src/lib/construct/rest-api-lambda/types.d.ts +6 -10
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.d.ts +0 -11
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.js +3 -14
- package/dist/src/lib/construct/rest-api-lambda-with-cache/types.d.ts +1 -3
- package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +0 -25
- package/dist/src/lib/construct/site-with-ecs-backend/main.js +32 -52
- package/dist/src/lib/construct/site-with-ecs-backend/types.d.ts +10 -11
- package/dist/src/lib/construct/static-asset-deployment/main.d.ts +0 -8
- package/dist/src/lib/construct/static-asset-deployment/main.js +0 -8
- package/dist/src/lib/construct/static-asset-deployment/types.d.ts +1 -1
- package/dist/src/lib/construct/static-site/main.d.ts +0 -17
- package/dist/src/lib/construct/static-site/main.js +1 -18
- package/dist/src/lib/construct/static-site/types.d.ts +9 -11
- package/dist/src/lib/services/aws/api-gateway/main.d.ts +21 -25
- package/dist/src/lib/services/aws/api-gateway/main.js +42 -46
- package/dist/src/lib/services/aws/api-gateway/types.d.ts +0 -2
- package/dist/src/lib/services/aws/appconfig/constants.d.ts +0 -6
- package/dist/src/lib/services/aws/appconfig/constants.js +26 -32
- package/dist/src/lib/services/aws/appconfig/main.d.ts +16 -19
- package/dist/src/lib/services/aws/appconfig/main.js +19 -22
- package/dist/src/lib/services/aws/appconfig/types.d.ts +1 -3
- package/dist/src/lib/services/aws/certificate-manager/main.d.ts +5 -10
- package/dist/src/lib/services/aws/certificate-manager/main.js +5 -10
- package/dist/src/lib/services/aws/certificate-manager/types.d.ts +3 -5
- package/dist/src/lib/services/aws/cloudfront/main.d.ts +41 -47
- package/dist/src/lib/services/aws/cloudfront/main.js +56 -62
- package/dist/src/lib/services/aws/cloudfront/types.d.ts +1 -7
- package/dist/src/lib/services/aws/cloudtrail/main.d.ts +8 -12
- package/dist/src/lib/services/aws/cloudtrail/main.js +8 -12
- package/dist/src/lib/services/aws/cloudtrail/types.d.ts +0 -2
- package/dist/src/lib/services/aws/cloudwatch/logs.d.ts +11 -15
- package/dist/src/lib/services/aws/cloudwatch/logs.js +15 -19
- package/dist/src/lib/services/aws/cloudwatch/main.d.ts +80 -84
- package/dist/src/lib/services/aws/cloudwatch/main.js +116 -122
- package/dist/src/lib/services/aws/cloudwatch/types.d.ts +20 -42
- package/dist/src/lib/services/aws/codebuild/main.d.ts +0 -4
- package/dist/src/lib/services/aws/codebuild/main.js +3 -7
- package/dist/src/lib/services/aws/dynamodb/main.d.ts +3 -7
- package/dist/src/lib/services/aws/dynamodb/main.js +13 -17
- package/dist/src/lib/services/aws/dynamodb/types.d.ts +0 -2
- package/dist/src/lib/services/aws/elastic-container-registry/main.d.ts +3 -7
- package/dist/src/lib/services/aws/elastic-container-registry/main.js +3 -7
- package/dist/src/lib/services/aws/elastic-container-service/main.d.ts +19 -23
- package/dist/src/lib/services/aws/elastic-container-service/main.js +35 -39
- package/dist/src/lib/services/aws/elastic-container-service/types.d.ts +1 -9
- package/dist/src/lib/services/aws/elastic-file-system/main.d.ts +9 -13
- package/dist/src/lib/services/aws/elastic-file-system/main.js +14 -18
- package/dist/src/lib/services/aws/elastic-file-system/types.d.ts +1 -5
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.d.ts +5 -9
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.js +8 -12
- package/dist/src/lib/services/aws/elastic-kubernetes-service/types.d.ts +1 -3
- package/dist/src/lib/services/aws/elasticache/main.d.ts +14 -18
- package/dist/src/lib/services/aws/elasticache/main.js +35 -39
- package/dist/src/lib/services/aws/elasticache/types.d.ts +0 -4
- package/dist/src/lib/services/aws/eventbridge/main.d.ts +25 -29
- package/dist/src/lib/services/aws/eventbridge/main.js +34 -38
- package/dist/src/lib/services/aws/eventbridge/target.d.ts +6 -9
- package/dist/src/lib/services/aws/eventbridge/target.js +8 -10
- package/dist/src/lib/services/aws/eventbridge/types.d.ts +2 -10
- package/dist/src/lib/services/aws/evidently/main.d.ts +15 -19
- package/dist/src/lib/services/aws/evidently/main.js +19 -23
- package/dist/src/lib/services/aws/evidently/types.d.ts +0 -10
- package/dist/src/lib/services/aws/identity-access-management/main.d.ts +66 -70
- package/dist/src/lib/services/aws/identity-access-management/main.js +97 -101
- package/dist/src/lib/services/aws/key-management-service/main.d.ts +3 -7
- package/dist/src/lib/services/aws/key-management-service/main.js +6 -10
- package/dist/src/lib/services/aws/key-management-service/types.d.ts +0 -2
- package/dist/src/lib/services/aws/lambda/main.d.ts +42 -47
- package/dist/src/lib/services/aws/lambda/main.js +64 -69
- package/dist/src/lib/services/aws/lambda/types.d.ts +6 -16
- package/dist/src/lib/services/aws/route53/main.d.ts +17 -21
- package/dist/src/lib/services/aws/route53/main.js +19 -23
- package/dist/src/lib/services/aws/route53/types.d.ts +0 -2
- package/dist/src/lib/services/aws/secrets-manager/main.d.ts +6 -19
- package/dist/src/lib/services/aws/secrets-manager/main.js +6 -25
- package/dist/src/lib/services/aws/simple-notification-service/main.d.ts +8 -12
- package/dist/src/lib/services/aws/simple-notification-service/main.js +10 -14
- package/dist/src/lib/services/aws/simple-notification-service/types.d.ts +0 -2
- package/dist/src/lib/services/aws/simple-queue-service/main.d.ts +11 -15
- package/dist/src/lib/services/aws/simple-queue-service/main.js +19 -23
- package/dist/src/lib/services/aws/simple-queue-service/types.d.ts +4 -6
- package/dist/src/lib/services/aws/simple-storage-service/main.d.ts +24 -32
- package/dist/src/lib/services/aws/simple-storage-service/main.js +32 -40
- package/dist/src/lib/services/aws/simple-storage-service/types.d.ts +2 -8
- package/dist/src/lib/services/aws/step-function/main.d.ts +55 -59
- package/dist/src/lib/services/aws/step-function/main.js +91 -95
- package/dist/src/lib/services/aws/step-function/types.d.ts +0 -32
- package/dist/src/lib/services/aws/systems-manager/main.d.ts +10 -16
- package/dist/src/lib/services/aws/systems-manager/main.js +13 -19
- package/dist/src/lib/services/aws/systems-manager/types.d.ts +0 -2
- package/dist/src/lib/services/aws/virtual-private-cloud/main.d.ts +9 -12
- package/dist/src/lib/services/aws/virtual-private-cloud/main.js +10 -16
- package/dist/src/lib/services/aws/web-application-firewall/main.d.ts +6 -10
- package/dist/src/lib/services/aws/web-application-firewall/main.js +12 -16
- package/dist/src/lib/services/aws/web-application-firewall/types.d.ts +0 -4
- package/dist/src/lib/types/aws/index.d.ts +0 -2
- package/dist/src/lib/utils/aws/index.d.ts +6 -9
- package/dist/src/lib/utils/aws/index.js +7 -10
- package/dist/src/lib/utils/index.d.ts +6 -13
- package/dist/src/lib/utils/index.js +4 -12
- package/package.json +1 -1
- package/src/lib/common/construct.ts +4 -7
- package/src/lib/common/stack.ts +9 -13
- package/src/lib/common/types.ts +0 -2
- package/src/lib/construct/api-to-eventbridge-target/api.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target/event.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target/main.ts +41 -68
- package/src/lib/construct/api-to-eventbridge-target/types.ts +13 -25
- package/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +44 -81
- package/src/lib/construct/api-to-eventbridge-target-with-sns/types.ts +1 -5
- package/src/lib/construct/api-to-lambda-target/api.ts +0 -3
- package/src/lib/construct/api-to-lambda-target/main.ts +7 -21
- package/src/lib/construct/api-to-lambda-target/types.ts +7 -13
- package/src/lib/construct/graphql-api-lambda/main.ts +1 -19
- package/src/lib/construct/graphql-api-lambda/types.ts +4 -8
- package/src/lib/construct/graphql-api-lambda-with-cache/main.ts +1 -12
- package/src/lib/construct/graphql-api-lambda-with-cache/types.ts +1 -3
- package/src/lib/construct/lambda-with-iam-access/main.ts +2 -14
- package/src/lib/construct/rest-api-lambda/main.ts +1 -19
- package/src/lib/construct/rest-api-lambda/types.ts +6 -10
- package/src/lib/construct/rest-api-lambda-with-cache/main.ts +3 -14
- package/src/lib/construct/rest-api-lambda-with-cache/types.ts +1 -3
- package/src/lib/construct/site-with-ecs-backend/main.ts +31 -52
- package/src/lib/construct/site-with-ecs-backend/types.ts +10 -11
- package/src/lib/construct/static-asset-deployment/main.ts +0 -8
- package/src/lib/construct/static-asset-deployment/types.ts +1 -1
- package/src/lib/construct/static-site/main.ts +1 -18
- package/src/lib/construct/static-site/types.ts +9 -11
- package/src/lib/services/aws/api-gateway/main.ts +43 -47
- package/src/lib/services/aws/api-gateway/types.ts +0 -2
- package/src/lib/services/aws/appconfig/constants.ts +26 -32
- package/src/lib/services/aws/appconfig/main.ts +19 -22
- package/src/lib/services/aws/appconfig/types.ts +1 -3
- package/src/lib/services/aws/certificate-manager/main.ts +5 -10
- package/src/lib/services/aws/certificate-manager/types.ts +3 -5
- package/src/lib/services/aws/cloudfront/main.ts +56 -62
- package/src/lib/services/aws/cloudfront/types.ts +1 -7
- package/src/lib/services/aws/cloudtrail/main.ts +8 -12
- package/src/lib/services/aws/cloudtrail/types.ts +0 -2
- package/src/lib/services/aws/cloudwatch/logs.ts +15 -19
- package/src/lib/services/aws/cloudwatch/main.ts +116 -122
- package/src/lib/services/aws/cloudwatch/types.ts +20 -42
- package/src/lib/services/aws/codebuild/main.ts +3 -7
- package/src/lib/services/aws/dynamodb/main.ts +13 -17
- package/src/lib/services/aws/dynamodb/types.ts +0 -2
- package/src/lib/services/aws/elastic-container-registry/main.ts +3 -7
- package/src/lib/services/aws/elastic-container-service/main.ts +35 -39
- package/src/lib/services/aws/elastic-container-service/types.ts +1 -9
- package/src/lib/services/aws/elastic-file-system/main.ts +14 -18
- package/src/lib/services/aws/elastic-file-system/types.ts +1 -5
- package/src/lib/services/aws/elastic-kubernetes-service/main.ts +8 -12
- package/src/lib/services/aws/elastic-kubernetes-service/types.ts +1 -3
- package/src/lib/services/aws/elasticache/main.ts +35 -39
- package/src/lib/services/aws/elasticache/types.ts +0 -4
- package/src/lib/services/aws/eventbridge/main.ts +34 -38
- package/src/lib/services/aws/eventbridge/target.ts +8 -11
- package/src/lib/services/aws/eventbridge/types.ts +2 -10
- package/src/lib/services/aws/evidently/main.ts +19 -23
- package/src/lib/services/aws/evidently/types.ts +0 -10
- package/src/lib/services/aws/identity-access-management/main.ts +97 -101
- package/src/lib/services/aws/key-management-service/main.ts +6 -10
- package/src/lib/services/aws/key-management-service/types.ts +0 -2
- package/src/lib/services/aws/lambda/main.ts +64 -69
- package/src/lib/services/aws/lambda/types.ts +6 -16
- package/src/lib/services/aws/route53/main.ts +19 -23
- package/src/lib/services/aws/route53/types.ts +0 -2
- package/src/lib/services/aws/secrets-manager/main.ts +6 -28
- package/src/lib/services/aws/simple-notification-service/main.ts +10 -14
- package/src/lib/services/aws/simple-notification-service/types.ts +0 -2
- package/src/lib/services/aws/simple-queue-service/main.ts +19 -23
- package/src/lib/services/aws/simple-queue-service/types.ts +4 -6
- package/src/lib/services/aws/simple-storage-service/main.ts +32 -40
- package/src/lib/services/aws/simple-storage-service/types.ts +2 -8
- package/src/lib/services/aws/step-function/main.ts +91 -95
- package/src/lib/services/aws/step-function/types.ts +0 -32
- package/src/lib/services/aws/systems-manager/main.ts +13 -19
- package/src/lib/services/aws/systems-manager/types.ts +0 -2
- package/src/lib/services/aws/virtual-private-cloud/main.ts +10 -16
- package/src/lib/services/aws/web-application-firewall/main.ts +12 -16
- package/src/lib/services/aws/web-application-firewall/types.ts +0 -4
- package/src/lib/types/aws/index.ts +0 -2
- package/src/lib/utils/aws/index.ts +7 -10
- package/src/lib/utils/index.ts +4 -12
|
@@ -3,9 +3,6 @@ import * as codebuild from 'aws-cdk-lib/aws-codebuild'
|
|
|
3
3
|
import { CommonConstruct } from '../../../common'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @stability stable
|
|
7
|
-
* @category cdk-utils.codebuild-manager
|
|
8
|
-
* @subcategory Construct
|
|
9
6
|
* @classdesc Provides operations on AWS Code Build.
|
|
10
7
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
11
8
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -19,7 +16,6 @@ import { CommonConstruct } from '../../../common'
|
|
|
19
16
|
* this.codeBuildManager.createImageForCloudfrontInvalidation('MyInvalidation', this, './docker ')
|
|
20
17
|
* }
|
|
21
18
|
* }
|
|
22
|
-
*
|
|
23
19
|
* @see [CDK Codebuild Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild-readme.html}
|
|
24
20
|
*/
|
|
25
21
|
export class CodeBuildManager {
|
|
@@ -50,9 +46,7 @@ export class CodeBuildManager {
|
|
|
50
46
|
) {
|
|
51
47
|
const invalidationPaths = paths ?? '/*'
|
|
52
48
|
return new codebuild.Project(scope, `${id}-install-deps-project`, {
|
|
53
|
-
role: scope.iamManager.roleForCloudfrontInvalidation(id, scope),
|
|
54
49
|
buildSpec: codebuild.BuildSpec.fromObject({
|
|
55
|
-
version: '0.1',
|
|
56
50
|
phases: {
|
|
57
51
|
build: {
|
|
58
52
|
commands: [
|
|
@@ -60,6 +54,7 @@ export class CodeBuildManager {
|
|
|
60
54
|
],
|
|
61
55
|
},
|
|
62
56
|
},
|
|
57
|
+
version: '0.1',
|
|
63
58
|
}),
|
|
64
59
|
environment: {
|
|
65
60
|
buildImage: codebuild.LinuxBuildImage.fromDockerRegistry(
|
|
@@ -70,12 +65,13 @@ export class CodeBuildManager {
|
|
|
70
65
|
},
|
|
71
66
|
logging: {
|
|
72
67
|
cloudWatch: {
|
|
68
|
+
enabled: true,
|
|
73
69
|
logGroup: scope.logManager.createLogGroup(`${id}-project-log-group`, scope, {
|
|
74
70
|
logGroupName: `${id}-cloudfront-invalidation`,
|
|
75
71
|
}),
|
|
76
|
-
enabled: true,
|
|
77
72
|
},
|
|
78
73
|
},
|
|
74
|
+
role: scope.iamManager.roleForCloudfrontInvalidation(id, scope),
|
|
79
75
|
timeout: cdk.Duration.minutes(5),
|
|
80
76
|
})
|
|
81
77
|
}
|
|
@@ -5,9 +5,6 @@ import { CommonConstruct } from '../../../common'
|
|
|
5
5
|
import { TableProps } from './types'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @stability stable
|
|
9
|
-
* @category cdk-utils.dynamodb-manager
|
|
10
|
-
* @subcategory Construct
|
|
11
8
|
* @classdesc Provides operations on AWS DynamoDB.
|
|
12
9
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
13
10
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -21,37 +18,36 @@ import { TableProps } from './types'
|
|
|
21
18
|
* this.dynamodbManager.createTable('MyTable', this, tableProps)
|
|
22
19
|
* }
|
|
23
20
|
* }
|
|
24
|
-
*
|
|
25
21
|
* @see [CDK Certificate Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb-readme.html}
|
|
26
22
|
*/
|
|
27
23
|
export class DynamodbManager {
|
|
28
24
|
/**
|
|
29
25
|
* @summary Method to create a table
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param scope scope in which this resource is defined
|
|
28
|
+
* @param props table props
|
|
33
29
|
*/
|
|
34
30
|
public createTable(id: string, scope: CommonConstruct, props: TableProps) {
|
|
35
31
|
if (!props) throw `Table props undefined for ${id}`
|
|
36
32
|
|
|
37
33
|
const table = new dynamodb.Table(scope, `${id}`, {
|
|
38
|
-
tableName: `${props.tableName}-${scope.props.stage}`,
|
|
39
|
-
partitionKey: props.partitionKey,
|
|
40
|
-
sortKey: props.sortKey,
|
|
41
|
-
kinesisStream: props.kinesisStream,
|
|
42
|
-
readCapacity: props.readCapacity,
|
|
43
|
-
writeCapacity: props.writeCapacity,
|
|
44
34
|
billingMode: props.billingMode,
|
|
45
|
-
|
|
35
|
+
contributorInsightsEnabled: props.contributorInsightsEnabled,
|
|
46
36
|
encryption: props.encryption,
|
|
47
37
|
encryptionKey: props.encryptionKey,
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
kinesisStream: props.kinesisStream,
|
|
39
|
+
partitionKey: props.partitionKey,
|
|
40
|
+
pointInTimeRecovery: props.pointInTimeRecovery,
|
|
41
|
+
readCapacity: props.readCapacity,
|
|
50
42
|
removalPolicy: props.removalPolicy,
|
|
51
43
|
replicationRegions: props.replicationRegions,
|
|
52
44
|
replicationTimeout: props.replicationTimeout,
|
|
45
|
+
sortKey: props.sortKey,
|
|
46
|
+
stream: props.stream,
|
|
47
|
+
tableName: `${props.tableName}-${scope.props.stage}`,
|
|
48
|
+
timeToLiveAttribute: props.timeToLiveAttribute,
|
|
53
49
|
waitForReplicationToFinish: props.waitForReplicationToFinish,
|
|
54
|
-
|
|
50
|
+
writeCapacity: props.writeCapacity,
|
|
55
51
|
})
|
|
56
52
|
|
|
57
53
|
if (props.tags && props.tags.length > 0) {
|
|
@@ -3,9 +3,6 @@ import * as utils from '../../../utils'
|
|
|
3
3
|
import { CommonConstruct } from '../../../common'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @stability stable
|
|
7
|
-
* @category cdk-utils.ecr-manager
|
|
8
|
-
* @subcategory Construct
|
|
9
6
|
* @classdesc Provides operations on AWS Elastic Container Registry.
|
|
10
7
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
11
8
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -19,15 +16,14 @@ import { CommonConstruct } from '../../../common'
|
|
|
19
16
|
* this.ecrManager.createDockerImage('MyImage', this, dockerfilePath)
|
|
20
17
|
* }
|
|
21
18
|
* }
|
|
22
|
-
*
|
|
23
19
|
* @see [CDK ECR Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr-readme.html}
|
|
24
20
|
*/
|
|
25
21
|
export class EcrManager {
|
|
26
22
|
/**
|
|
27
23
|
* @summary Method to create a docker image in ecr
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
24
|
+
* @param id scoped id of the resource
|
|
25
|
+
* @param scope scope in which this resource is defined
|
|
26
|
+
* @param dockerfilePath
|
|
31
27
|
*/
|
|
32
28
|
public createDockerImage(id: string, scope: CommonConstruct, dockerfilePath: string) {
|
|
33
29
|
const asset = new ecr.DockerImageAsset(scope, `${id}`, {
|
|
@@ -9,9 +9,6 @@ import { CommonConstruct } from '../../../common'
|
|
|
9
9
|
import { EcsApplicationLoadBalancedFargateServiceProps, EcsClusterProps, EcsTaskProps } from './types'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* @stability stable
|
|
13
|
-
* @category cdk-utils.ecs-manager
|
|
14
|
-
* @subcategory Construct
|
|
15
12
|
* @classdesc Provides operations on AWS Elastic Container Service.
|
|
16
13
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
17
14
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -25,28 +22,27 @@ import { EcsApplicationLoadBalancedFargateServiceProps, EcsClusterProps, EcsTask
|
|
|
25
22
|
* this.ecsManager.createEcsCluster('MyCluster', this, vpc)
|
|
26
23
|
* }
|
|
27
24
|
* }
|
|
28
|
-
*
|
|
29
25
|
* @see [CDK ECS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs-readme.html}
|
|
30
26
|
*/
|
|
31
27
|
export class EcsManager {
|
|
32
28
|
/**
|
|
33
29
|
* @summary Method to create an ecs cluster
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
30
|
+
* @param id scoped id of the resource
|
|
31
|
+
* @param scope scope in which this resource is defined
|
|
32
|
+
* @param props
|
|
33
|
+
* @param vpc
|
|
38
34
|
*/
|
|
39
35
|
public createEcsCluster(id: string, scope: CommonConstruct, props: EcsClusterProps, vpc: ec2.IVpc) {
|
|
40
36
|
if (!props) throw `Ecs Cluster props undefined for ${id}`
|
|
41
37
|
|
|
42
38
|
const ecsCluster = new ecs.Cluster(scope, `${id}`, {
|
|
39
|
+
capacity: props.capacity,
|
|
43
40
|
clusterName: `${props.clusterName}-${scope.props.stage}`,
|
|
44
|
-
|
|
41
|
+
containerInsights: props.containerInsights,
|
|
45
42
|
defaultCloudMapNamespace: props.defaultCloudMapNamespace,
|
|
46
|
-
capacity: props.capacity,
|
|
47
43
|
enableFargateCapacityProviders: props.enableFargateCapacityProviders,
|
|
48
|
-
containerInsights: props.containerInsights,
|
|
49
44
|
executeCommandConfiguration: props.executeCommandConfiguration,
|
|
45
|
+
vpc: vpc,
|
|
50
46
|
})
|
|
51
47
|
|
|
52
48
|
if (props.tags && props.tags.length > 0) {
|
|
@@ -63,16 +59,16 @@ export class EcsManager {
|
|
|
63
59
|
|
|
64
60
|
/**
|
|
65
61
|
* @summary Method to create an ecs fargate task
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
69
|
-
* @param
|
|
70
|
-
* @param
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
62
|
+
* @param id scoped id of the resource
|
|
63
|
+
* @param scope scope in which this resource is defined
|
|
64
|
+
* @param props
|
|
65
|
+
* @param cluster
|
|
66
|
+
* @param role
|
|
67
|
+
* @param logGroup
|
|
68
|
+
* @param containerImage
|
|
69
|
+
* @param environment
|
|
70
|
+
* @param secrets
|
|
71
|
+
* @param command
|
|
76
72
|
*/
|
|
77
73
|
public createEcsFargateTask(
|
|
78
74
|
id: string,
|
|
@@ -94,36 +90,36 @@ export class EcsManager {
|
|
|
94
90
|
ephemeralStorageGiB: props.ephemeralStorageGiB,
|
|
95
91
|
executionRole: role,
|
|
96
92
|
family: `${props.family}-${scope.props.stage}`,
|
|
97
|
-
ipcMode: props.ipcMode,
|
|
98
93
|
inferenceAccelerators: props.inferenceAccelerators,
|
|
94
|
+
ipcMode: props.ipcMode,
|
|
99
95
|
memoryMiB: props.memoryMiB,
|
|
100
96
|
networkMode: ecs.NetworkMode.AWS_VPC,
|
|
101
97
|
pidMode: props.pidMode,
|
|
102
98
|
placementConstraints: props.placementConstraints,
|
|
103
99
|
proxyConfiguration: props.proxyConfiguration,
|
|
104
100
|
runtimePlatform: {
|
|
105
|
-
operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? ecs.OperatingSystemFamily.LINUX,
|
|
106
101
|
cpuArchitecture: props.runtimePlatform?.cpuArchitecture ?? ecs.CpuArchitecture.X86_64,
|
|
102
|
+
operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? ecs.OperatingSystemFamily.LINUX,
|
|
107
103
|
},
|
|
108
104
|
taskRole: role,
|
|
109
105
|
volumes: props.volumes,
|
|
110
106
|
})
|
|
111
107
|
|
|
112
108
|
ecsTask.addContainer('EcsContainer', {
|
|
109
|
+
command: command,
|
|
113
110
|
cpu: props.cpu ? parseInt(props.cpu) : undefined,
|
|
114
111
|
disableNetworking: false,
|
|
115
112
|
environment: environment,
|
|
116
113
|
image: containerImage,
|
|
117
114
|
logging: ecs.LogDriver.awsLogs({
|
|
118
115
|
logGroup: logGroup,
|
|
119
|
-
streamPrefix: `${id}`,
|
|
120
|
-
multilinePattern: props.logging?.multilinePattern,
|
|
121
116
|
logRetention: props.logging?.logRetention,
|
|
117
|
+
multilinePattern: props.logging?.multilinePattern,
|
|
118
|
+
streamPrefix: `${id}`,
|
|
122
119
|
}),
|
|
123
120
|
memoryLimitMiB: props.memoryMiB ? parseInt(props.memoryMiB) : undefined,
|
|
124
121
|
privileged: false,
|
|
125
122
|
secrets: secrets,
|
|
126
|
-
command: command,
|
|
127
123
|
})
|
|
128
124
|
|
|
129
125
|
if (props.tags && props.tags.length > 0) {
|
|
@@ -139,11 +135,11 @@ export class EcsManager {
|
|
|
139
135
|
|
|
140
136
|
/**
|
|
141
137
|
* @summary Method to create an application loadbalanced ecs fargate task
|
|
142
|
-
* @param
|
|
143
|
-
* @param
|
|
144
|
-
* @param
|
|
145
|
-
* @param
|
|
146
|
-
* @param
|
|
138
|
+
* @param id scoped id of the resource
|
|
139
|
+
* @param scope scope in which this resource is defined
|
|
140
|
+
* @param props
|
|
141
|
+
* @param cluster
|
|
142
|
+
* @param logGroup
|
|
147
143
|
*/
|
|
148
144
|
public createLoadBalancedFargateService(
|
|
149
145
|
id: string,
|
|
@@ -169,26 +165,26 @@ export class EcsManager {
|
|
|
169
165
|
loadBalancerName: `${id}-${scope.props.stage}`,
|
|
170
166
|
memoryLimitMiB: props.memoryLimitMiB,
|
|
171
167
|
runtimePlatform: {
|
|
172
|
-
operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? ecs.OperatingSystemFamily.LINUX,
|
|
173
168
|
cpuArchitecture: props.runtimePlatform?.cpuArchitecture ?? ecs.CpuArchitecture.X86_64,
|
|
169
|
+
operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? ecs.OperatingSystemFamily.LINUX,
|
|
174
170
|
},
|
|
175
171
|
serviceName: `${id}-${scope.props.stage}`,
|
|
176
172
|
taskImageOptions: {
|
|
173
|
+
containerPort: props.taskImageOptions?.containerPort,
|
|
177
174
|
enableLogging: props.taskImageOptions?.enableLogging ?? true,
|
|
175
|
+
environment: props.taskImageOptions?.environment,
|
|
176
|
+
executionRole: props.taskImageOptions?.executionRole,
|
|
177
|
+
image: props.taskImageOptions.image,
|
|
178
178
|
logDriver:
|
|
179
179
|
props.taskImageOptions?.logDriver ??
|
|
180
180
|
ecs.LogDriver.awsLogs({
|
|
181
181
|
logGroup: logGroup,
|
|
182
|
-
streamPrefix: `${id}-${scope.props.stage}/ecs`,
|
|
183
|
-
multilinePattern: props.logging?.multilinePattern,
|
|
184
182
|
logRetention: props.logging?.logRetention,
|
|
183
|
+
multilinePattern: props.logging?.multilinePattern,
|
|
184
|
+
streamPrefix: `${id}-${scope.props.stage}/ecs`,
|
|
185
185
|
}),
|
|
186
|
-
image: props.taskImageOptions.image,
|
|
187
|
-
executionRole: props.taskImageOptions?.executionRole,
|
|
188
|
-
taskRole: props.taskImageOptions?.taskRole,
|
|
189
|
-
containerPort: props.taskImageOptions?.containerPort,
|
|
190
|
-
environment: props.taskImageOptions?.environment,
|
|
191
186
|
secrets: props.taskImageOptions?.secrets,
|
|
187
|
+
taskRole: props.taskImageOptions?.taskRole,
|
|
192
188
|
},
|
|
193
189
|
})
|
|
194
190
|
|
|
@@ -5,16 +5,12 @@ import { ApplicationLoadBalancedFargateServiceProps } from 'aws-cdk-lib/aws-ecs-
|
|
|
5
5
|
import * as elb from 'aws-cdk-lib/aws-elasticloadbalancingv2'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @category cdk-utils.ecs-manager
|
|
9
|
-
* @subcategory Properties
|
|
10
8
|
*/
|
|
11
9
|
export interface EcsClusterProps extends ClusterProps {
|
|
12
10
|
tags?: TagProps[]
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
/**
|
|
16
|
-
* @category cdk-utils.ecs-manager
|
|
17
|
-
* @subcategory Properties
|
|
18
14
|
*/
|
|
19
15
|
export interface EcsTaskProps extends TaskDefinitionProps {
|
|
20
16
|
logging?: AwsLogDriverProps
|
|
@@ -22,8 +18,8 @@ export interface EcsTaskProps extends TaskDefinitionProps {
|
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
export interface EcsScalingProps {
|
|
25
|
-
minCapacity?: number
|
|
26
21
|
maxCapacity?: number
|
|
22
|
+
minCapacity?: number
|
|
27
23
|
scaleOnCpuUtilization?: number
|
|
28
24
|
scaleOnMemoryUtilization?: number
|
|
29
25
|
scaleOnRequestsPerTarget?: number
|
|
@@ -31,8 +27,6 @@ export interface EcsScalingProps {
|
|
|
31
27
|
}
|
|
32
28
|
|
|
33
29
|
/**
|
|
34
|
-
* @category cdk-utils.site-with-ecs-backend
|
|
35
|
-
* @subcategory Properties
|
|
36
30
|
*/
|
|
37
31
|
export interface HealthCheck extends elb.HealthCheck {
|
|
38
32
|
intervalInSecs: number
|
|
@@ -40,8 +34,6 @@ export interface HealthCheck extends elb.HealthCheck {
|
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
/**
|
|
43
|
-
* @category cdk-utils.ecs-manager
|
|
44
|
-
* @subcategory Properties
|
|
45
37
|
*/
|
|
46
38
|
export interface EcsApplicationLoadBalancedFargateServiceProps extends ApplicationLoadBalancedFargateServiceProps {
|
|
47
39
|
healthCheck?: HealthCheck
|
|
@@ -6,20 +6,17 @@ import { CommonConstruct } from '../../../common'
|
|
|
6
6
|
import { EfsAccessPointOptions, EfsFileSystemProps } from './types'
|
|
7
7
|
|
|
8
8
|
export const DEFAULT_CREATE_ACL = {
|
|
9
|
-
ownerUid: '1000',
|
|
10
9
|
ownerGid: '1000',
|
|
10
|
+
ownerUid: '1000',
|
|
11
11
|
permissions: '755',
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const DEFAULT_POSIX_USER = {
|
|
15
|
-
uid: '1000',
|
|
16
15
|
gid: '1000',
|
|
16
|
+
uid: '1000',
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* @stability stable
|
|
21
|
-
* @category cdk-utils.efs-manager
|
|
22
|
-
* @subcategory Construct
|
|
23
20
|
* @classdesc Provides operations on AWS Elastic File System.
|
|
24
21
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
25
22
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -33,19 +30,18 @@ export const DEFAULT_POSIX_USER = {
|
|
|
33
30
|
* this.efsManager.createFileSystem('MyFileSystem', this, fileSystemProps, vpc)
|
|
34
31
|
* }
|
|
35
32
|
* }
|
|
36
|
-
*
|
|
37
33
|
* @see [CDK EFS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_efs-readme.html}
|
|
38
34
|
*/
|
|
39
35
|
export class EfsManager {
|
|
40
36
|
/**
|
|
41
37
|
* @summary Method to create an efs file system
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
38
|
+
* @param id scoped id of the resource
|
|
39
|
+
* @param scope scope in which this resource is defined
|
|
40
|
+
* @param props the file system props
|
|
41
|
+
* @param vpc the vpc to use for the file system
|
|
42
|
+
* @param accessPointOptions optional access point configuration options for the file system
|
|
43
|
+
* @param securityGroup optional security groups to configure for the file system
|
|
44
|
+
* @param vpcSubnets optional subnets to configure for the file system
|
|
49
45
|
*/
|
|
50
46
|
public createFileSystem(
|
|
51
47
|
id: string,
|
|
@@ -61,14 +57,14 @@ export class EfsManager {
|
|
|
61
57
|
const fileSystemId = props.provisionNewOnDeployment ? `${id}-${new Date().getMilliseconds()}` : `${id}`
|
|
62
58
|
const fileSystem = new efs.FileSystem(scope, `${fileSystemId}`, {
|
|
63
59
|
...props,
|
|
64
|
-
vpc,
|
|
65
|
-
securityGroup,
|
|
66
|
-
vpcSubnets,
|
|
67
60
|
fileSystemName: props.fileSystemName ? `${props.fileSystemName}-${scope.props.stage}` : undefined,
|
|
68
61
|
lifecyclePolicy: props.lifecyclePolicy ?? efs.LifecyclePolicy.AFTER_7_DAYS,
|
|
69
|
-
performanceMode: props.performanceMode ?? efs.PerformanceMode.GENERAL_PURPOSE,
|
|
70
62
|
outOfInfrequentAccessPolicy: props.outOfInfrequentAccessPolicy ?? efs.OutOfInfrequentAccessPolicy.AFTER_1_ACCESS,
|
|
63
|
+
performanceMode: props.performanceMode ?? efs.PerformanceMode.GENERAL_PURPOSE,
|
|
71
64
|
removalPolicy: props.removalPolicy ?? cdk.RemovalPolicy.DESTROY,
|
|
65
|
+
securityGroup,
|
|
66
|
+
vpc,
|
|
67
|
+
vpcSubnets,
|
|
72
68
|
})
|
|
73
69
|
|
|
74
70
|
utils.createCfnOutput(`${id}-fileSystemArn`, scope, fileSystem.fileSystemArn)
|
|
@@ -79,8 +75,8 @@ export class EfsManager {
|
|
|
79
75
|
for (const [index, accessPointOption] of accessPointOptions.entries()) {
|
|
80
76
|
if (!accessPointOption.path) throw `Undefined access point path for option: [${accessPointOption}], id: [${id}]`
|
|
81
77
|
const accessPoint = fileSystem.addAccessPoint(`${id}-ap-${index}`, {
|
|
82
|
-
path: accessPointOption.path,
|
|
83
78
|
createAcl: accessPointOption.createAcl ?? DEFAULT_CREATE_ACL,
|
|
79
|
+
path: accessPointOption.path,
|
|
84
80
|
posixUser: accessPointOption.posixUser ?? DEFAULT_POSIX_USER,
|
|
85
81
|
})
|
|
86
82
|
|
|
@@ -2,19 +2,15 @@ import { AccessPointOptions, FileSystemProps } from 'aws-cdk-lib/aws-efs'
|
|
|
2
2
|
import { AuthorizationConfig } from 'aws-cdk-lib/aws-ecs'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @category cdk-utils.efs-manager
|
|
6
|
-
* @subcategory Properties
|
|
7
5
|
*/
|
|
8
6
|
export interface EfsFileSystemProps extends FileSystemProps {
|
|
7
|
+
authorizationConfig?: AuthorizationConfig
|
|
9
8
|
provisionNewOnDeployment?: boolean
|
|
10
9
|
rootDirectory?: string
|
|
11
10
|
transitEncryption?: string
|
|
12
11
|
transitEncryptionPort?: number
|
|
13
|
-
authorizationConfig?: AuthorizationConfig
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
|
-
* @category cdk-utils.efs-manager
|
|
18
|
-
* @subcategory Properties
|
|
19
15
|
*/
|
|
20
16
|
export interface EfsAccessPointOptions extends AccessPointOptions {}
|
|
@@ -6,9 +6,6 @@ import { CommonConstruct } from '../../../common'
|
|
|
6
6
|
import { EksClusterProps } from './types'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @stability stable
|
|
10
|
-
* @category cdk-utils.eks-manager
|
|
11
|
-
* @subcategory Construct
|
|
12
9
|
* @classdesc Provides operations on AWS Elastic Kubernetes Service.
|
|
13
10
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
14
11
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -22,17 +19,16 @@ import { EksClusterProps } from './types'
|
|
|
22
19
|
* this.eksManager.createEksDeployment('MyEksDeployment', this, image, vpc)
|
|
23
20
|
* }
|
|
24
21
|
* }
|
|
25
|
-
*
|
|
26
22
|
* @see [CDK EKS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_eks-readme.html}
|
|
27
23
|
*/
|
|
28
24
|
export class EksManager {
|
|
29
25
|
/**
|
|
30
26
|
* @summary Method to create an eks deployment
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
27
|
+
* @param id scoped id of the resource
|
|
28
|
+
* @param scope scope in which this resource is defined
|
|
29
|
+
* @param props
|
|
30
|
+
* @param image
|
|
31
|
+
* @param vpc
|
|
36
32
|
*/
|
|
37
33
|
public createEksDeployment(
|
|
38
34
|
id: string,
|
|
@@ -56,8 +52,8 @@ export class EksManager {
|
|
|
56
52
|
spec: {
|
|
57
53
|
containers: [
|
|
58
54
|
{
|
|
59
|
-
name: `${id}`.toLowerCase(),
|
|
60
55
|
image: image.imageUri,
|
|
56
|
+
name: `${id}`.toLowerCase(),
|
|
61
57
|
ports: [{ containerPort: props.appContainerPort }],
|
|
62
58
|
},
|
|
63
59
|
],
|
|
@@ -71,16 +67,16 @@ export class EksManager {
|
|
|
71
67
|
kind: 'Service',
|
|
72
68
|
metadata: { name: `${id}`.toLowerCase() },
|
|
73
69
|
spec: {
|
|
74
|
-
type: 'LoadBalancer',
|
|
75
70
|
ports: [
|
|
76
71
|
{
|
|
77
72
|
name: 'http-port',
|
|
78
|
-
protocol: 'TCP',
|
|
79
73
|
port: 80,
|
|
74
|
+
protocol: 'TCP',
|
|
80
75
|
targetPort: props.appContainerPort,
|
|
81
76
|
},
|
|
82
77
|
],
|
|
83
78
|
selector: appLabel,
|
|
79
|
+
type: 'LoadBalancer',
|
|
84
80
|
},
|
|
85
81
|
}
|
|
86
82
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ClusterProps } from 'aws-cdk-lib/aws-eks'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @category cdk-utils.eks-manager
|
|
5
|
-
* @subcategory Properties
|
|
6
4
|
*/
|
|
7
5
|
export interface EksClusterProps extends ClusterProps {
|
|
8
|
-
appContainerPort: number
|
|
9
6
|
appCapacity: number
|
|
7
|
+
appContainerPort: number
|
|
10
8
|
}
|
|
@@ -5,9 +5,6 @@ import { CommonConstruct } from '../../../common'
|
|
|
5
5
|
import { ElastiCacheProps, ReplicatedElastiCacheProps } from './types'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @stability stable
|
|
9
|
-
* @category cdk-utils.elasticache-manager
|
|
10
|
-
* @subcategory Construct
|
|
11
8
|
* @summary Provides operations on AWS ElastiCache Service.
|
|
12
9
|
* - A new instance of scope class is injected into {@link CommonConstruct} constructor.
|
|
13
10
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -21,32 +18,31 @@ import { ElastiCacheProps, ReplicatedElastiCacheProps } from './types'
|
|
|
21
18
|
* this.elasticacheManager.createElastiCache('MyElastiCache', scope, props)
|
|
22
19
|
* }
|
|
23
20
|
* }
|
|
24
|
-
*
|
|
25
21
|
* @see [CDK ElastiCache Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticache-readme.html}
|
|
26
22
|
*/
|
|
27
23
|
export class ElastiCacheManager {
|
|
28
24
|
/**
|
|
29
25
|
* @summary Method to create an elasticache resource
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param scope scope in which scope resource is defined
|
|
28
|
+
* @param subnetIds
|
|
33
29
|
*/
|
|
34
30
|
public createElastiCacheSubnetGroup(id: string, scope: CommonConstruct, subnetIds: string[]) {
|
|
35
31
|
return new elasticache.CfnSubnetGroup(scope, `${id}`, {
|
|
36
32
|
cacheSubnetGroupName: `${id}-subnet-group-${scope.props.stage}`,
|
|
37
|
-
subnetIds: subnetIds,
|
|
38
33
|
description: `${id}-subnet-group-${scope.props.stage}`,
|
|
34
|
+
subnetIds: subnetIds,
|
|
39
35
|
})
|
|
40
36
|
}
|
|
41
37
|
|
|
42
38
|
/**
|
|
43
39
|
* @summary Method to create an elasticache resource
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
40
|
+
* @param id scoped id of the resource
|
|
41
|
+
* @param scope scope in which scope resource is defined
|
|
42
|
+
* @param props
|
|
43
|
+
* @param subnetIds
|
|
44
|
+
* @param securityGroupIds
|
|
45
|
+
* @param logDeliveryConfigurations
|
|
50
46
|
*/
|
|
51
47
|
public createElastiCache(
|
|
52
48
|
id: string,
|
|
@@ -61,25 +57,25 @@ export class ElastiCacheManager {
|
|
|
61
57
|
const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds)
|
|
62
58
|
|
|
63
59
|
const elasticacheCluster = new elasticache.CfnCacheCluster(scope, `${id}`, {
|
|
60
|
+
autoMinorVersionUpgrade: props.autoMinorVersionUpgrade,
|
|
61
|
+
azMode: props.azMode,
|
|
62
|
+
cacheNodeType: props.cacheNodeType,
|
|
63
|
+
cacheParameterGroupName: props.cacheParameterGroupName,
|
|
64
|
+
cacheSecurityGroupNames: props.cacheSecurityGroupNames,
|
|
65
|
+
cacheSubnetGroupName: subnetGroup.cacheSubnetGroupName,
|
|
66
|
+
clusterName: `${id}-${scope.props.stage}`,
|
|
64
67
|
engine: props.engine,
|
|
65
68
|
engineVersion: props.engineVersion,
|
|
66
|
-
|
|
69
|
+
logDeliveryConfigurations: logDeliveryConfigurations,
|
|
67
70
|
numCacheNodes: props.numCacheNodes,
|
|
68
|
-
|
|
69
|
-
vpcSecurityGroupIds: securityGroupIds,
|
|
70
|
-
cacheSubnetGroupName: subnetGroup.cacheSubnetGroupName,
|
|
71
|
-
azMode: props.azMode,
|
|
71
|
+
port: props.port,
|
|
72
72
|
preferredAvailabilityZones: props.preferredAvailabilityZones,
|
|
73
73
|
preferredMaintenanceWindow: props.preferredMaintenanceWindow,
|
|
74
|
-
autoMinorVersionUpgrade: props.autoMinorVersionUpgrade,
|
|
75
|
-
cacheParameterGroupName: props.cacheParameterGroupName,
|
|
76
|
-
cacheSecurityGroupNames: props.cacheSecurityGroupNames,
|
|
77
|
-
port: props.port,
|
|
78
74
|
snapshotArns: props.snapshotArns,
|
|
79
75
|
snapshotName: props.snapshotName,
|
|
80
76
|
snapshotRetentionLimit: props.snapshotRetentionLimit,
|
|
81
77
|
snapshotWindow: props.snapshotWindow,
|
|
82
|
-
|
|
78
|
+
vpcSecurityGroupIds: securityGroupIds,
|
|
83
79
|
})
|
|
84
80
|
|
|
85
81
|
elasticacheCluster.addDependency(subnetGroup)
|
|
@@ -99,11 +95,11 @@ export class ElastiCacheManager {
|
|
|
99
95
|
|
|
100
96
|
/**
|
|
101
97
|
* @summary Method to create an replicated elasticache resource
|
|
102
|
-
* @param
|
|
103
|
-
* @param
|
|
104
|
-
* @param
|
|
105
|
-
* @param
|
|
106
|
-
* @param
|
|
98
|
+
* @param id scoped id of the resource
|
|
99
|
+
* @param scope scope in which scope resource is defined
|
|
100
|
+
* @param props
|
|
101
|
+
* @param subnetIds
|
|
102
|
+
* @param securityGroupIds
|
|
107
103
|
*/
|
|
108
104
|
public createReplicatedElastiCache(
|
|
109
105
|
id: string,
|
|
@@ -117,27 +113,27 @@ export class ElastiCacheManager {
|
|
|
117
113
|
const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds)
|
|
118
114
|
|
|
119
115
|
const elasticacheCluster = new elasticache.CfnReplicationGroup(scope, `${id}`, {
|
|
120
|
-
|
|
121
|
-
replicationGroupId: `${id}-${scope.props.stage}`,
|
|
122
|
-
cacheNodeType: props.cacheNodeType,
|
|
123
|
-
engine: props.engine,
|
|
124
|
-
cacheSubnetGroupName: subnetGroup.cacheSubnetGroupName,
|
|
125
|
-
securityGroupIds: securityGroupIds,
|
|
126
|
-
numNodeGroups: props.numNodeGroups,
|
|
127
|
-
replicasPerNodeGroup: props.replicasPerNodeGroup,
|
|
116
|
+
autoMinorVersionUpgrade: props.autoMinorVersionUpgrade,
|
|
128
117
|
automaticFailoverEnabled: props.automaticFailoverEnabled,
|
|
129
|
-
|
|
118
|
+
cacheNodeType: props.cacheNodeType,
|
|
130
119
|
cacheParameterGroupName: props.cacheParameterGroupName,
|
|
131
120
|
cacheSecurityGroupNames: props.cacheSecurityGroupNames,
|
|
121
|
+
cacheSubnetGroupName: subnetGroup.cacheSubnetGroupName,
|
|
122
|
+
engine: props.engine,
|
|
132
123
|
engineVersion: props.engineVersion,
|
|
133
124
|
globalReplicationGroupId: props.globalReplicationGroupId,
|
|
134
125
|
logDeliveryConfigurations: props.logDeliveryConfigurations,
|
|
126
|
+
multiAzEnabled: props.multiAzEnabled,
|
|
135
127
|
numCacheClusters: props.numCacheClusters,
|
|
128
|
+
numNodeGroups: props.numNodeGroups,
|
|
136
129
|
port: props.port,
|
|
137
130
|
preferredCacheClusterAZs: props.preferredCacheClusterAZs,
|
|
138
131
|
preferredMaintenanceWindow: props.preferredMaintenanceWindow,
|
|
139
132
|
primaryClusterId: props.primaryClusterId,
|
|
140
|
-
|
|
133
|
+
replicasPerNodeGroup: props.replicasPerNodeGroup,
|
|
134
|
+
replicationGroupDescription: `${id} Redis Replication Cluster`,
|
|
135
|
+
replicationGroupId: `${id}-${scope.props.stage}`,
|
|
136
|
+
securityGroupIds: securityGroupIds,
|
|
141
137
|
})
|
|
142
138
|
|
|
143
139
|
elasticacheCluster.addDependency(subnetGroup)
|