@gradientedge/cdk-utils-aws 2.4.1 → 2.6.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/dist/src/construct/api-to-any-target/main.d.ts +11 -0
- package/dist/src/construct/api-to-any-target/main.js +11 -2
- package/dist/src/construct/api-to-any-target/target.d.ts +16 -1
- package/dist/src/construct/api-to-any-target/target.js +16 -1
- package/dist/src/construct/api-to-any-target/types.d.ts +52 -0
- package/dist/src/construct/api-to-eventbridge-target/api.d.ts +18 -0
- package/dist/src/construct/api-to-eventbridge-target/api.js +18 -0
- package/dist/src/construct/api-to-eventbridge-target/event.d.ts +7 -0
- package/dist/src/construct/api-to-eventbridge-target/event.js +7 -0
- package/dist/src/construct/api-to-eventbridge-target/main.d.ts +12 -0
- package/dist/src/construct/api-to-eventbridge-target/main.js +12 -3
- package/dist/src/construct/api-to-eventbridge-target/types.d.ts +67 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +7 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.js +7 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/main.d.ts +13 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/main.js +13 -4
- package/dist/src/construct/api-to-eventbridge-target-with-sns/types.d.ts +12 -0
- package/dist/src/construct/api-to-lambda-target/api.d.ts +19 -0
- package/dist/src/construct/api-to-lambda-target/api.js +19 -0
- package/dist/src/construct/api-to-lambda-target/main.d.ts +24 -0
- package/dist/src/construct/api-to-lambda-target/main.js +24 -2
- package/dist/src/construct/api-to-lambda-target/types.d.ts +41 -0
- package/dist/src/construct/application-configuration/main.d.ts +29 -1
- package/dist/src/construct/application-configuration/main.js +28 -1
- package/dist/src/construct/application-configuration/types.d.ts +5 -0
- package/dist/src/construct/event-handler/handler.d.ts +23 -1
- package/dist/src/construct/event-handler/handler.js +23 -1
- package/dist/src/construct/event-handler/main.d.ts +13 -0
- package/dist/src/construct/event-handler/main.js +13 -0
- package/dist/src/construct/event-handler/types.d.ts +35 -0
- package/dist/src/construct/lambda-with-iam-access/main.d.ts +21 -0
- package/dist/src/construct/lambda-with-iam-access/main.js +21 -2
- package/dist/src/construct/lambda-with-iam-access/types.d.ts +18 -0
- package/dist/src/construct/piped-event-handler/main.d.ts +9 -0
- package/dist/src/construct/piped-event-handler/main.js +9 -0
- package/dist/src/construct/piped-event-handler/types.d.ts +7 -0
- package/dist/src/construct/rest-api-lambda/main.d.ts +23 -0
- package/dist/src/construct/rest-api-lambda/main.js +19 -2
- package/dist/src/construct/rest-api-lambda/types.d.ts +14 -0
- package/dist/src/construct/rest-api-lambda-with-cache/main.d.ts +12 -0
- package/dist/src/construct/rest-api-lambda-with-cache/main.js +12 -2
- package/dist/src/construct/rest-api-lambda-with-cache/types.d.ts +6 -0
- package/dist/src/construct/site-with-ecs-backend/constants.d.ts +5 -0
- package/dist/src/construct/site-with-ecs-backend/constants.js +5 -0
- package/dist/src/construct/site-with-ecs-backend/main.d.ts +37 -0
- package/dist/src/construct/site-with-ecs-backend/main.js +37 -2
- package/dist/src/construct/site-with-ecs-backend/types.d.ts +45 -0
- package/dist/src/construct/site-with-lambda-backend/constants.d.ts +8 -0
- package/dist/src/construct/site-with-lambda-backend/constants.js +8 -0
- package/dist/src/construct/site-with-lambda-backend/main.d.ts +31 -0
- package/dist/src/construct/site-with-lambda-backend/main.js +31 -2
- package/dist/src/construct/site-with-lambda-backend/types.d.ts +42 -0
- package/dist/src/construct/static-asset-deployment/main.d.ts +10 -0
- package/dist/src/construct/static-asset-deployment/main.js +10 -1
- package/dist/src/construct/static-asset-deployment/types.d.ts +14 -0
- package/dist/src/construct/static-site/main.d.ts +17 -0
- package/dist/src/construct/static-site/main.js +17 -2
- package/dist/src/construct/static-site/types.d.ts +18 -0
- package/dist/src/services/api-gateway/main.d.ts +20 -20
- package/dist/src/services/api-gateway/main.js +20 -20
- package/dist/src/services/api-gateway/types.d.ts +7 -0
- package/dist/src/services/appconfig/constants.d.ts +2 -2
- package/dist/src/services/appconfig/constants.js +2 -2
- package/dist/src/services/appconfig/main.d.ts +5 -5
- package/dist/src/services/appconfig/main.js +5 -5
- package/dist/src/services/appconfig/types.d.ts +11 -1
- package/dist/src/services/certificate-manager/types.d.ts +8 -0
- package/dist/src/services/cloudfront/main.d.ts +28 -28
- package/dist/src/services/cloudfront/main.js +28 -28
- package/dist/src/services/cloudfront/types.d.ts +8 -0
- package/dist/src/services/cloudwatch/logs.d.ts +4 -4
- package/dist/src/services/cloudwatch/logs.js +4 -4
- package/dist/src/services/cloudwatch/main.d.ts +24 -24
- package/dist/src/services/cloudwatch/main.js +25 -24
- package/dist/src/services/cloudwatch/types.d.ts +66 -0
- package/dist/src/services/dynamodb/main.d.ts +2 -2
- package/dist/src/services/dynamodb/main.js +2 -2
- package/dist/src/services/dynamodb/types.d.ts +8 -0
- package/dist/src/services/elastic-container-registry/main.d.ts +1 -1
- package/dist/src/services/elastic-container-registry/main.js +1 -1
- package/dist/src/services/elastic-container-service/main.d.ts +13 -13
- package/dist/src/services/elastic-container-service/main.js +16 -13
- package/dist/src/services/elastic-container-service/types.d.ts +30 -1
- package/dist/src/services/elastic-file-system/types.d.ts +9 -0
- package/dist/src/services/elastic-kubernetes-service/main.d.ts +3 -3
- package/dist/src/services/elastic-kubernetes-service/main.js +7 -3
- package/dist/src/services/elastic-kubernetes-service/types.d.ts +4 -0
- package/dist/src/services/elasticache/main.d.ts +14 -14
- package/dist/src/services/elasticache/main.js +18 -14
- package/dist/src/services/elasticache/types.d.ts +4 -0
- package/dist/src/services/eventbridge/main.d.ts +11 -11
- package/dist/src/services/eventbridge/main.js +19 -11
- package/dist/src/services/eventbridge/target.d.ts +5 -1
- package/dist/src/services/eventbridge/target.js +6 -1
- package/dist/src/services/eventbridge/types.d.ts +27 -1
- package/dist/src/services/evidently/types.d.ts +10 -0
- package/dist/src/services/identity-access-management/main.d.ts +42 -42
- package/dist/src/services/identity-access-management/main.js +42 -42
- package/dist/src/services/key-management-service/types.d.ts +2 -0
- package/dist/src/services/lambda/main.d.ts +25 -25
- package/dist/src/services/lambda/main.js +26 -25
- package/dist/src/services/lambda/types.d.ts +34 -0
- package/dist/src/services/route53/main.js +2 -0
- package/dist/src/services/route53/types.d.ts +3 -0
- package/dist/src/services/secrets-manager/main.js +2 -0
- package/dist/src/services/secrets-manager/types.d.ts +4 -0
- package/dist/src/services/simple-notification-service/types.d.ts +2 -0
- package/dist/src/services/simple-queue-service/main.js +2 -0
- package/dist/src/services/simple-queue-service/types.d.ts +11 -0
- package/dist/src/services/simple-storage-service/main.d.ts +1 -1
- package/dist/src/services/simple-storage-service/main.js +5 -1
- package/dist/src/services/simple-storage-service/types.d.ts +16 -0
- package/dist/src/services/step-function/types.d.ts +54 -0
- package/dist/src/services/systems-manager/main.d.ts +15 -4
- package/dist/src/services/systems-manager/main.js +17 -4
- package/dist/src/services/systems-manager/types.d.ts +8 -0
- package/dist/src/services/virtual-private-cloud/ipv6.d.ts +19 -1
- package/dist/src/services/virtual-private-cloud/ipv6.js +26 -1
- package/dist/src/services/virtual-private-cloud/main.js +1 -2
- package/dist/src/services/virtual-private-cloud/types.d.ts +5 -0
- package/dist/src/services/web-application-firewall/types.d.ts +4 -0
- package/dist/src/types/index.d.ts +3 -0
- package/dist/src/utils/index.d.ts +9 -3
- package/dist/src/utils/index.js +10 -3
- package/package.json +5 -5
|
@@ -4,48 +4,77 @@ import { ApplicationLoadBalancedFargateServiceProps } from 'aws-cdk-lib/aws-ecs-
|
|
|
4
4
|
import { HealthCheck as ElbHealthCheck } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
|
|
5
5
|
import { TagProps } from '../../types/index.js';
|
|
6
6
|
/**
|
|
7
|
+
* Properties for creating an ECS cluster.
|
|
8
|
+
* @see {@link ClusterProps}
|
|
7
9
|
*/
|
|
8
10
|
/** @category Interface */
|
|
9
11
|
export interface EcsClusterProps extends ClusterProps {
|
|
12
|
+
/** Optional tags to apply to the ECS cluster */
|
|
10
13
|
tags?: TagProps[];
|
|
11
14
|
}
|
|
12
15
|
/**
|
|
16
|
+
* Properties for creating an ECS task definition.
|
|
17
|
+
* @see {@link TaskDefinitionProps}
|
|
13
18
|
*/
|
|
14
19
|
/** @category Interface */
|
|
15
20
|
export interface EcsTaskProps extends TaskDefinitionProps {
|
|
21
|
+
/** Optional AWS log driver configuration for container logging */
|
|
16
22
|
logging?: AwsLogDriverProps;
|
|
23
|
+
/** Optional tags to apply to the task definition */
|
|
17
24
|
tags?: TagProps[];
|
|
18
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Properties for configuring ECS service auto-scaling.
|
|
28
|
+
*/
|
|
19
29
|
/** @category Interface */
|
|
20
30
|
export interface EcsScalingProps {
|
|
31
|
+
/** Maximum number of tasks to scale out to */
|
|
21
32
|
maxCapacity?: number;
|
|
33
|
+
/** Minimum number of tasks to maintain */
|
|
22
34
|
minCapacity?: number;
|
|
35
|
+
/** Target CPU utilization percentage for scaling */
|
|
23
36
|
scaleOnCpuUtilization?: number;
|
|
37
|
+
/** Target memory utilization percentage for scaling */
|
|
24
38
|
scaleOnMemoryUtilization?: number;
|
|
39
|
+
/** Target number of requests per target for scaling */
|
|
25
40
|
scaleOnRequestsPerTarget?: number;
|
|
41
|
+
/** Schedule-based scaling configuration */
|
|
26
42
|
scaleOnSchedule?: ScalingSchedule;
|
|
27
43
|
}
|
|
28
44
|
/**
|
|
45
|
+
* Health check configuration for ELB-based health checks with interval and timeout in seconds.
|
|
46
|
+
* @see {@link ElbHealthCheck}
|
|
29
47
|
*/
|
|
30
48
|
/** @category Interface */
|
|
31
49
|
export interface HealthCheck extends ElbHealthCheck {
|
|
50
|
+
/** Health check interval in seconds */
|
|
32
51
|
intervalInSecs: number;
|
|
52
|
+
/** Health check timeout in seconds */
|
|
33
53
|
timeoutInSecs: number;
|
|
34
54
|
}
|
|
35
55
|
/**
|
|
36
|
-
*
|
|
56
|
+
* Health check configuration for Application Load Balanced Fargate services with interval and timeout in seconds.
|
|
57
|
+
* @see {@link FargateHealthCheck}
|
|
37
58
|
*/
|
|
38
59
|
/** @category Interface */
|
|
39
60
|
export interface EcsApplicationLoadBalancedFargateServiceHealthCheck extends FargateHealthCheck {
|
|
61
|
+
/** Health check interval in seconds */
|
|
40
62
|
intervalInSecs: number;
|
|
63
|
+
/** Health check timeout in seconds */
|
|
41
64
|
timeoutInSecs: number;
|
|
42
65
|
}
|
|
43
66
|
/**
|
|
67
|
+
* Properties for creating an Application Load Balanced Fargate service.
|
|
68
|
+
* @see {@link ApplicationLoadBalancedFargateServiceProps}
|
|
44
69
|
*/
|
|
45
70
|
/** @category Interface */
|
|
46
71
|
export interface EcsApplicationLoadBalancedFargateServiceProps extends ApplicationLoadBalancedFargateServiceProps {
|
|
72
|
+
/** Optional health check configuration for the Fargate service */
|
|
47
73
|
healthCheck?: EcsApplicationLoadBalancedFargateServiceHealthCheck;
|
|
74
|
+
/** Optional AWS log driver configuration for container logging */
|
|
48
75
|
logging?: AwsLogDriverProps;
|
|
76
|
+
/** Optional mount points for container volumes */
|
|
49
77
|
mountPoints?: MountPoint[];
|
|
78
|
+
/** Optional auto-scaling configuration for the service */
|
|
50
79
|
siteScaling?: EcsScalingProps;
|
|
51
80
|
}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { AuthorizationConfig } from 'aws-cdk-lib/aws-ecs';
|
|
2
2
|
import { AccessPointOptions, FileSystemProps } from 'aws-cdk-lib/aws-efs';
|
|
3
3
|
/**
|
|
4
|
+
* Properties for creating an EFS file system.
|
|
5
|
+
* @see {@link FileSystemProps}
|
|
4
6
|
*/
|
|
5
7
|
/** @category Interface */
|
|
6
8
|
export interface EfsFileSystemProps extends FileSystemProps {
|
|
9
|
+
/** Optional ECS authorization configuration for mounting the file system */
|
|
7
10
|
authorizationConfig?: AuthorizationConfig;
|
|
11
|
+
/** When true, appends a timestamp to the logical ID to force replacement on each deployment */
|
|
8
12
|
provisionNewOnDeployment?: boolean;
|
|
13
|
+
/** Optional root directory path for the file system mount */
|
|
9
14
|
rootDirectory?: string;
|
|
15
|
+
/** Optional transit encryption mode for data in transit */
|
|
10
16
|
transitEncryption?: string;
|
|
17
|
+
/** Optional port number for transit encryption */
|
|
11
18
|
transitEncryptionPort?: number;
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
21
|
+
* Options for creating an EFS access point.
|
|
22
|
+
* @see {@link AccessPointOptions}
|
|
14
23
|
*/
|
|
15
24
|
/** @category Interface */
|
|
16
25
|
export interface EfsAccessPointOptions extends AccessPointOptions {
|
|
@@ -25,9 +25,9 @@ export declare class EksManager {
|
|
|
25
25
|
* @summary Method to create an eks deployment
|
|
26
26
|
* @param id scoped id of the resource
|
|
27
27
|
* @param scope scope in which this resource is defined
|
|
28
|
-
* @param props
|
|
29
|
-
* @param image
|
|
30
|
-
* @param vpc
|
|
28
|
+
* @param props the EKS cluster properties including application capacity and port
|
|
29
|
+
* @param image the Docker image asset to deploy in the cluster
|
|
30
|
+
* @param vpc the VPC in which the EKS cluster will be created
|
|
31
31
|
*/
|
|
32
32
|
createEksDeployment(id: string, scope: CommonConstruct, props: EksClusterProps, image: DockerImageAsset, vpc: IVpc): Cluster;
|
|
33
33
|
}
|
|
@@ -23,9 +23,9 @@ export class EksManager {
|
|
|
23
23
|
* @summary Method to create an eks deployment
|
|
24
24
|
* @param id scoped id of the resource
|
|
25
25
|
* @param scope scope in which this resource is defined
|
|
26
|
-
* @param props
|
|
27
|
-
* @param image
|
|
28
|
-
* @param vpc
|
|
26
|
+
* @param props the EKS cluster properties including application capacity and port
|
|
27
|
+
* @param image the Docker image asset to deploy in the cluster
|
|
28
|
+
* @param vpc the VPC in which the EKS cluster will be created
|
|
29
29
|
*/
|
|
30
30
|
createEksDeployment(id, scope, props, image, vpc) {
|
|
31
31
|
if (!props)
|
|
@@ -33,6 +33,7 @@ export class EksManager {
|
|
|
33
33
|
if (!props.clusterName)
|
|
34
34
|
throw new Error(`EksCluster clusterName undefined for ${id}`);
|
|
35
35
|
const appLabel = { app: `${id}`.toLowerCase() };
|
|
36
|
+
/* Define the Kubernetes Deployment manifest for the application */
|
|
36
37
|
const deployment = {
|
|
37
38
|
apiVersion: 'apps/v1',
|
|
38
39
|
kind: 'Deployment',
|
|
@@ -53,6 +54,7 @@ export class EksManager {
|
|
|
53
54
|
},
|
|
54
55
|
},
|
|
55
56
|
};
|
|
57
|
+
/* Define the Kubernetes Service manifest with a LoadBalancer to expose the application */
|
|
56
58
|
const service = {
|
|
57
59
|
apiVersion: 'v1',
|
|
58
60
|
kind: 'Service',
|
|
@@ -70,6 +72,7 @@ export class EksManager {
|
|
|
70
72
|
type: 'LoadBalancer',
|
|
71
73
|
},
|
|
72
74
|
};
|
|
75
|
+
/* Create the EKS cluster with default capacity using T3 Large instances */
|
|
73
76
|
const cluster = new Cluster(scope, `${id}Cluster`, {
|
|
74
77
|
clusterName: scope.resourceNameFormatter.format(props.clusterName, scope.props.resourceNameOptions?.eks),
|
|
75
78
|
defaultCapacity: props.appCapacity,
|
|
@@ -78,6 +81,7 @@ export class EksManager {
|
|
|
78
81
|
version: KubernetesVersion.V1_27,
|
|
79
82
|
vpc,
|
|
80
83
|
});
|
|
84
|
+
/* Apply both the Service and Deployment manifests to the cluster */
|
|
81
85
|
cluster.addManifest(`${id}Pod`, service, deployment);
|
|
82
86
|
createCfnOutput(`${id}-clusterArn`, scope, cluster.clusterArn);
|
|
83
87
|
createCfnOutput(`${id}-clusterEndpoint`, scope, cluster.clusterEndpoint);
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { ClusterProps } from 'aws-cdk-lib/aws-eks';
|
|
2
2
|
/**
|
|
3
|
+
* Properties for creating an EKS cluster with application deployment.
|
|
4
|
+
* @see {@link ClusterProps}
|
|
3
5
|
*/
|
|
4
6
|
/** @category Interface */
|
|
5
7
|
export interface EksClusterProps extends ClusterProps {
|
|
8
|
+
/** The number of default capacity instances to provision in the cluster */
|
|
6
9
|
appCapacity: number;
|
|
10
|
+
/** The container port the application listens on */
|
|
7
11
|
appContainerPort: number;
|
|
8
12
|
}
|
|
@@ -20,29 +20,29 @@ import { ElastiCacheProps, ReplicatedElastiCacheProps } from './types.js';
|
|
|
20
20
|
*/
|
|
21
21
|
export declare class ElastiCacheManager {
|
|
22
22
|
/**
|
|
23
|
-
* @summary Method to create an
|
|
23
|
+
* @summary Method to create an ElastiCache subnet group
|
|
24
24
|
* @param id scoped id of the resource
|
|
25
|
-
* @param scope scope in which
|
|
26
|
-
* @param subnetIds
|
|
25
|
+
* @param scope scope in which this resource is defined
|
|
26
|
+
* @param subnetIds the list of subnet IDs to include in the subnet group
|
|
27
27
|
*/
|
|
28
28
|
createElastiCacheSubnetGroup(id: string, scope: CommonConstruct, subnetIds: string[]): CfnSubnetGroup;
|
|
29
29
|
/**
|
|
30
|
-
* @summary Method to create an
|
|
30
|
+
* @summary Method to create an ElastiCache cache cluster
|
|
31
31
|
* @param id scoped id of the resource
|
|
32
|
-
* @param scope scope in which
|
|
33
|
-
* @param props
|
|
34
|
-
* @param subnetIds
|
|
35
|
-
* @param securityGroupIds
|
|
36
|
-
* @param logDeliveryConfigurations
|
|
32
|
+
* @param scope scope in which this resource is defined
|
|
33
|
+
* @param props the ElastiCache cluster properties
|
|
34
|
+
* @param subnetIds the list of subnet IDs for the cache subnet group
|
|
35
|
+
* @param securityGroupIds the list of VPC security group IDs to associate with the cluster
|
|
36
|
+
* @param logDeliveryConfigurations optional log delivery configuration for the cluster
|
|
37
37
|
*/
|
|
38
38
|
createElastiCache(id: string, scope: CommonConstruct, props: ElastiCacheProps, subnetIds: string[], securityGroupIds: string[], logDeliveryConfigurations?: any): CfnCacheCluster;
|
|
39
39
|
/**
|
|
40
|
-
* @summary Method to create
|
|
40
|
+
* @summary Method to create a replicated ElastiCache replication group
|
|
41
41
|
* @param id scoped id of the resource
|
|
42
|
-
* @param scope scope in which
|
|
43
|
-
* @param props
|
|
44
|
-
* @param subnetIds
|
|
45
|
-
* @param securityGroupIds
|
|
42
|
+
* @param scope scope in which this resource is defined
|
|
43
|
+
* @param props the replicated ElastiCache properties
|
|
44
|
+
* @param subnetIds the list of subnet IDs for the cache subnet group
|
|
45
|
+
* @param securityGroupIds the list of VPC security group IDs to associate with the replication group
|
|
46
46
|
*/
|
|
47
47
|
createReplicatedElastiCache(id: string, scope: CommonConstruct, props: ReplicatedElastiCacheProps, subnetIds: string[], securityGroupIds: string[]): CfnReplicationGroup;
|
|
48
48
|
}
|
|
@@ -21,10 +21,10 @@ import { createCfnOutput } from '../../utils/index.js';
|
|
|
21
21
|
*/
|
|
22
22
|
export class ElastiCacheManager {
|
|
23
23
|
/**
|
|
24
|
-
* @summary Method to create an
|
|
24
|
+
* @summary Method to create an ElastiCache subnet group
|
|
25
25
|
* @param id scoped id of the resource
|
|
26
|
-
* @param scope scope in which
|
|
27
|
-
* @param subnetIds
|
|
26
|
+
* @param scope scope in which this resource is defined
|
|
27
|
+
* @param subnetIds the list of subnet IDs to include in the subnet group
|
|
28
28
|
*/
|
|
29
29
|
createElastiCacheSubnetGroup(id, scope, subnetIds) {
|
|
30
30
|
return new CfnSubnetGroup(scope, `${id}`, {
|
|
@@ -34,19 +34,20 @@ export class ElastiCacheManager {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
* @summary Method to create an
|
|
37
|
+
* @summary Method to create an ElastiCache cache cluster
|
|
38
38
|
* @param id scoped id of the resource
|
|
39
|
-
* @param scope scope in which
|
|
40
|
-
* @param props
|
|
41
|
-
* @param subnetIds
|
|
42
|
-
* @param securityGroupIds
|
|
43
|
-
* @param logDeliveryConfigurations
|
|
39
|
+
* @param scope scope in which this resource is defined
|
|
40
|
+
* @param props the ElastiCache cluster properties
|
|
41
|
+
* @param subnetIds the list of subnet IDs for the cache subnet group
|
|
42
|
+
* @param securityGroupIds the list of VPC security group IDs to associate with the cluster
|
|
43
|
+
* @param logDeliveryConfigurations optional log delivery configuration for the cluster
|
|
44
44
|
*/
|
|
45
45
|
createElastiCache(id, scope, props, subnetIds, securityGroupIds, logDeliveryConfigurations) {
|
|
46
46
|
if (!props)
|
|
47
47
|
throw new Error(`ElastiCache props undefined for ${id}`);
|
|
48
48
|
if (!props.clusterName)
|
|
49
49
|
throw new Error(`ElastiCache clusterName undefined for ${id}`);
|
|
50
|
+
/* Create a dedicated subnet group before provisioning the cache cluster */
|
|
50
51
|
const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds);
|
|
51
52
|
const elasticacheCluster = new CfnCacheCluster(scope, `${id}`, {
|
|
52
53
|
...props,
|
|
@@ -55,6 +56,7 @@ export class ElastiCacheManager {
|
|
|
55
56
|
logDeliveryConfigurations,
|
|
56
57
|
vpcSecurityGroupIds: securityGroupIds,
|
|
57
58
|
});
|
|
59
|
+
/* Ensure the subnet group is created before the cache cluster */
|
|
58
60
|
elasticacheCluster.addDependency(subnetGroup);
|
|
59
61
|
if (props.tags && !_.isEmpty(props.tags)) {
|
|
60
62
|
_.forEach(props.tags, tag => {
|
|
@@ -67,16 +69,17 @@ export class ElastiCacheManager {
|
|
|
67
69
|
return elasticacheCluster;
|
|
68
70
|
}
|
|
69
71
|
/**
|
|
70
|
-
* @summary Method to create
|
|
72
|
+
* @summary Method to create a replicated ElastiCache replication group
|
|
71
73
|
* @param id scoped id of the resource
|
|
72
|
-
* @param scope scope in which
|
|
73
|
-
* @param props
|
|
74
|
-
* @param subnetIds
|
|
75
|
-
* @param securityGroupIds
|
|
74
|
+
* @param scope scope in which this resource is defined
|
|
75
|
+
* @param props the replicated ElastiCache properties
|
|
76
|
+
* @param subnetIds the list of subnet IDs for the cache subnet group
|
|
77
|
+
* @param securityGroupIds the list of VPC security group IDs to associate with the replication group
|
|
76
78
|
*/
|
|
77
79
|
createReplicatedElastiCache(id, scope, props, subnetIds, securityGroupIds) {
|
|
78
80
|
if (!props)
|
|
79
81
|
throw new Error(`ElastiCache props undefined for ${id}`);
|
|
82
|
+
/* Create a dedicated subnet group before provisioning the replication group */
|
|
80
83
|
const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds);
|
|
81
84
|
const elasticacheCluster = new CfnReplicationGroup(scope, `${id}`, {
|
|
82
85
|
...props,
|
|
@@ -85,6 +88,7 @@ export class ElastiCacheManager {
|
|
|
85
88
|
replicationGroupId: `${id}-${scope.props.stage}`,
|
|
86
89
|
securityGroupIds,
|
|
87
90
|
});
|
|
91
|
+
/* Ensure the subnet group is created before the replication group */
|
|
88
92
|
elasticacheCluster.addDependency(subnetGroup);
|
|
89
93
|
return elasticacheCluster;
|
|
90
94
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { CfnCacheClusterProps, CfnReplicationGroupProps } from 'aws-cdk-lib/aws-elasticache';
|
|
2
2
|
/**
|
|
3
|
+
* Properties for creating an ElastiCache cache cluster.
|
|
4
|
+
* @see {@link CfnCacheClusterProps}
|
|
3
5
|
*/
|
|
4
6
|
/** @category Interface */
|
|
5
7
|
export interface ElastiCacheProps extends CfnCacheClusterProps {
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
10
|
+
* Properties for creating an ElastiCache replication group.
|
|
11
|
+
* @see {@link CfnReplicationGroupProps}
|
|
8
12
|
*/
|
|
9
13
|
/** @category Interface */
|
|
10
14
|
export interface ReplicatedElastiCacheProps extends CfnReplicationGroupProps {
|
|
@@ -45,23 +45,23 @@ export declare class EventManager {
|
|
|
45
45
|
* @summary Method to create an eventbridge rule with lambda target
|
|
46
46
|
* @param id scoped id of the resource
|
|
47
47
|
* @param scope scope in which this resource is defined
|
|
48
|
-
* @param props
|
|
49
|
-
* @param lambdaFunction
|
|
50
|
-
* @param eventBusName
|
|
51
|
-
* @param eventPattern
|
|
52
|
-
* @param scheduleExpression
|
|
48
|
+
* @param props the CfnRule properties for the event rule
|
|
49
|
+
* @param lambdaFunction the Lambda function to invoke as the rule target
|
|
50
|
+
* @param eventBusName optional name of the custom event bus to attach the rule to
|
|
51
|
+
* @param eventPattern optional event pattern to filter events
|
|
52
|
+
* @param scheduleExpression optional cron or rate expression for scheduled rules
|
|
53
53
|
*/
|
|
54
54
|
createLambdaRule(id: string, scope: CommonConstruct, props: RuleProps, lambdaFunction: IFunction, eventBusName?: string, eventPattern?: any, scheduleExpression?: string): CfnRule;
|
|
55
55
|
/**
|
|
56
56
|
* @summary Method to create an eventbridge rule with fargate task target
|
|
57
57
|
* @param id scoped id of the resource
|
|
58
58
|
* @param scope scope in which this resource is defined
|
|
59
|
-
* @param props
|
|
60
|
-
* @param cluster
|
|
61
|
-
* @param task
|
|
62
|
-
* @param subnetIds
|
|
63
|
-
* @param role
|
|
64
|
-
* @param eventPattern
|
|
59
|
+
* @param props the CfnRule properties for the event rule
|
|
60
|
+
* @param cluster the ECS cluster to run the Fargate task in
|
|
61
|
+
* @param task the ECS task definition to execute
|
|
62
|
+
* @param subnetIds the list of subnet IDs for the Fargate task's VPC configuration
|
|
63
|
+
* @param role the IAM role granting EventBridge permission to run the ECS task
|
|
64
|
+
* @param eventPattern optional event pattern to filter events
|
|
65
65
|
*/
|
|
66
66
|
createFargateTaskRule(id: string, scope: CommonConstruct, props: RuleProps, cluster: ICluster, task: ITaskDefinition, subnetIds: string[], role: Role | CfnRole, eventPattern?: any): CfnRule;
|
|
67
67
|
/**
|
|
@@ -34,6 +34,7 @@ export class EventManager {
|
|
|
34
34
|
throw new Error(`EventBus props undefined for ${id}`);
|
|
35
35
|
if (!props.eventBusName)
|
|
36
36
|
throw new Error(`EventBus eventBusName undefined for ${id}`);
|
|
37
|
+
/* Skip name formatting for the 'default' event bus since it is an AWS built-in name */
|
|
37
38
|
let eventBusName = props.eventBusName;
|
|
38
39
|
if (eventBusName !== 'default') {
|
|
39
40
|
eventBusName = scope.resourceNameFormatter.format(props.eventBusName, scope.props.resourceNameOptions?.eventbridgeBus);
|
|
@@ -82,11 +83,11 @@ export class EventManager {
|
|
|
82
83
|
* @summary Method to create an eventbridge rule with lambda target
|
|
83
84
|
* @param id scoped id of the resource
|
|
84
85
|
* @param scope scope in which this resource is defined
|
|
85
|
-
* @param props
|
|
86
|
-
* @param lambdaFunction
|
|
87
|
-
* @param eventBusName
|
|
88
|
-
* @param eventPattern
|
|
89
|
-
* @param scheduleExpression
|
|
86
|
+
* @param props the CfnRule properties for the event rule
|
|
87
|
+
* @param lambdaFunction the Lambda function to invoke as the rule target
|
|
88
|
+
* @param eventBusName optional name of the custom event bus to attach the rule to
|
|
89
|
+
* @param eventPattern optional event pattern to filter events
|
|
90
|
+
* @param scheduleExpression optional cron or rate expression for scheduled rules
|
|
90
91
|
*/
|
|
91
92
|
createLambdaRule(id, scope, props, lambdaFunction, eventBusName, eventPattern, scheduleExpression) {
|
|
92
93
|
if (!props)
|
|
@@ -113,6 +114,7 @@ export class EventManager {
|
|
|
113
114
|
Tags.of(eventRule).add(tag.key, tag.value);
|
|
114
115
|
});
|
|
115
116
|
}
|
|
117
|
+
/* Grant EventBridge permission to invoke the Lambda function */
|
|
116
118
|
new CfnPermission(scope, `${id}LambdaPermission`, {
|
|
117
119
|
action: 'lambda:InvokeFunction',
|
|
118
120
|
functionName: lambdaFunction.functionName,
|
|
@@ -127,12 +129,12 @@ export class EventManager {
|
|
|
127
129
|
* @summary Method to create an eventbridge rule with fargate task target
|
|
128
130
|
* @param id scoped id of the resource
|
|
129
131
|
* @param scope scope in which this resource is defined
|
|
130
|
-
* @param props
|
|
131
|
-
* @param cluster
|
|
132
|
-
* @param task
|
|
133
|
-
* @param subnetIds
|
|
134
|
-
* @param role
|
|
135
|
-
* @param eventPattern
|
|
132
|
+
* @param props the CfnRule properties for the event rule
|
|
133
|
+
* @param cluster the ECS cluster to run the Fargate task in
|
|
134
|
+
* @param task the ECS task definition to execute
|
|
135
|
+
* @param subnetIds the list of subnet IDs for the Fargate task's VPC configuration
|
|
136
|
+
* @param role the IAM role granting EventBridge permission to run the ECS task
|
|
137
|
+
* @param eventPattern optional event pattern to filter events
|
|
136
138
|
*/
|
|
137
139
|
createFargateTaskRule(id, scope, props, cluster, task, subnetIds, role, eventPattern) {
|
|
138
140
|
if (!props)
|
|
@@ -177,6 +179,7 @@ export class EventManager {
|
|
|
177
179
|
throw new Error(`Pipe props undefined for ${id}`);
|
|
178
180
|
if (!props.name)
|
|
179
181
|
throw new Error(`Pipe name undefined for ${id}`);
|
|
182
|
+
/* Create an IAM role granting the pipe access to poll the SQS queue and start the Step Function */
|
|
180
183
|
const pipeRole = scope.iamManager.createRoleForSqsToSfnPipe(`${id}-role`, scope, sourceQueue.queueArn, targetStepFunction.stateMachineArn);
|
|
181
184
|
const pipe = new CfnPipe(scope, `${id}`, {
|
|
182
185
|
...props,
|
|
@@ -184,6 +187,7 @@ export class EventManager {
|
|
|
184
187
|
roleArn: pipeRole.roleArn,
|
|
185
188
|
source: sourceQueue.queueArn,
|
|
186
189
|
sourceParameters: {
|
|
190
|
+
/* Apply optional filter criteria to only forward matching SQS messages */
|
|
187
191
|
filterCriteria: props.pipeFilterPattern
|
|
188
192
|
? {
|
|
189
193
|
filters: [
|
|
@@ -223,6 +227,7 @@ export class EventManager {
|
|
|
223
227
|
throw new Error(`Pipe props undefined for ${id}`);
|
|
224
228
|
if (!props.name)
|
|
225
229
|
throw new Error(`Pipe name undefined for ${id}`);
|
|
230
|
+
/* Create an IAM role granting the pipe access to poll the SQS queue and invoke the Lambda */
|
|
226
231
|
const pipeRole = scope.iamManager.createRoleForSqsToLambdaPipe(`${id}-role`, scope, sourceQueue.queueArn, targetLambdaFunction.functionArn);
|
|
227
232
|
const pipe = new CfnPipe(scope, `${id}`, {
|
|
228
233
|
...props,
|
|
@@ -230,6 +235,7 @@ export class EventManager {
|
|
|
230
235
|
roleArn: pipeRole.roleArn,
|
|
231
236
|
source: sourceQueue.queueArn,
|
|
232
237
|
sourceParameters: {
|
|
238
|
+
/* Apply optional filter criteria to only forward matching SQS messages */
|
|
233
239
|
filterCriteria: props.pipeFilterPattern
|
|
234
240
|
? {
|
|
235
241
|
filters: [
|
|
@@ -266,6 +272,7 @@ export class EventManager {
|
|
|
266
272
|
throw new Error(`Pipe props undefined for ${id}`);
|
|
267
273
|
if (!props.name)
|
|
268
274
|
throw new Error(`Pipe name undefined for ${id}`);
|
|
275
|
+
/* Create an IAM role granting the pipe access to read the DynamoDB stream and invoke the Lambda */
|
|
269
276
|
const pipeRole = scope.iamManager.createRoleForDynamoDbToLambdaPipe(`${id}-role`, scope, sourceDynamoDbStreamArn, targetLambdaFunction.functionArn);
|
|
270
277
|
const pipe = new CfnPipe(scope, `${id}`, {
|
|
271
278
|
...props,
|
|
@@ -273,6 +280,7 @@ export class EventManager {
|
|
|
273
280
|
roleArn: pipeRole.roleArn,
|
|
274
281
|
source: sourceDynamoDbStreamArn,
|
|
275
282
|
sourceParameters: {
|
|
283
|
+
/* Apply optional filter criteria to only forward matching DynamoDB stream records */
|
|
276
284
|
filterCriteria: props.pipeFilterPattern
|
|
277
285
|
? {
|
|
278
286
|
filters: [
|
|
@@ -50,9 +50,13 @@ export interface LogGroupNoPolicyProps extends TargetBaseProps {
|
|
|
50
50
|
export declare class CloudWatchLogGroupNoPolicy implements IRuleTarget {
|
|
51
51
|
private readonly logGroup;
|
|
52
52
|
private readonly props;
|
|
53
|
+
/**
|
|
54
|
+
* @param logGroup the CloudWatch log group to use as the event target
|
|
55
|
+
* @param props optional configuration for the log group target
|
|
56
|
+
*/
|
|
53
57
|
constructor(logGroup: ILogGroup, props?: LogGroupNoPolicyProps);
|
|
54
58
|
/**
|
|
55
|
-
* Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup
|
|
59
|
+
* @summary Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup
|
|
56
60
|
*/
|
|
57
61
|
bind(): RuleTargetConfig;
|
|
58
62
|
}
|
|
@@ -37,14 +37,19 @@ export class EventTargetManager {
|
|
|
37
37
|
export class CloudWatchLogGroupNoPolicy {
|
|
38
38
|
logGroup;
|
|
39
39
|
props;
|
|
40
|
+
/**
|
|
41
|
+
* @param logGroup the CloudWatch log group to use as the event target
|
|
42
|
+
* @param props optional configuration for the log group target
|
|
43
|
+
*/
|
|
40
44
|
constructor(logGroup, props = {}) {
|
|
41
45
|
this.logGroup = logGroup;
|
|
42
46
|
this.props = props;
|
|
43
47
|
}
|
|
44
48
|
/**
|
|
45
|
-
* Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup
|
|
49
|
+
* @summary Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup
|
|
46
50
|
*/
|
|
47
51
|
bind() {
|
|
52
|
+
/* Resolve the log group's stack to build the ARN in the correct account/region */
|
|
48
53
|
const logGroupStack = Stack.of(this.logGroup);
|
|
49
54
|
return {
|
|
50
55
|
...bindBaseTargetConfig(this.props),
|
|
@@ -2,48 +2,74 @@ import { CfnRuleProps, EventBusProps as EBProps, RuleProps as EBRuleProps } from
|
|
|
2
2
|
import { CfnPipeProps } from 'aws-cdk-lib/aws-pipes';
|
|
3
3
|
import { TagProps } from '../../types/index.js';
|
|
4
4
|
/**
|
|
5
|
+
* Properties for creating an EventBridge Pipe from an SQS queue to a Step Function.
|
|
6
|
+
* @see {@link CfnPipeProps}
|
|
5
7
|
*/
|
|
6
8
|
/** @category Interface */
|
|
7
9
|
export interface SqsToSfnPipeProps extends CfnPipeProps {
|
|
10
|
+
/** Optional filter pattern to apply to SQS messages before forwarding */
|
|
8
11
|
pipeFilterPattern?: any;
|
|
12
|
+
/** Optional input template to transform the event before sending to the Step Function */
|
|
9
13
|
sfnInputTemplate?: string;
|
|
14
|
+
/** The invocation type for the Step Function target (e.g. 'FIRE_AND_FORGET') */
|
|
10
15
|
sfnInvocationType?: string;
|
|
16
|
+
/** The maximum number of SQS messages to process in a single batch */
|
|
11
17
|
sqsBatchSize?: number;
|
|
18
|
+
/** The maximum batching window in seconds before sending the batch */
|
|
12
19
|
sqsMaximumBatchingWindowInSeconds?: number;
|
|
13
20
|
}
|
|
14
21
|
/**
|
|
22
|
+
* Properties for creating an EventBridge Pipe from an SQS queue to a Lambda function.
|
|
23
|
+
* @see {@link CfnPipeProps}
|
|
15
24
|
*/
|
|
16
25
|
/** @category Interface */
|
|
17
26
|
export interface SqsToLambdaPipeProps extends CfnPipeProps {
|
|
27
|
+
/** Optional filter pattern to apply to SQS messages before forwarding */
|
|
18
28
|
pipeFilterPattern?: any;
|
|
29
|
+
/** The maximum number of SQS messages to process in a single batch */
|
|
19
30
|
sqsBatchSize?: number;
|
|
31
|
+
/** Optional input template to transform the event before sending to the Lambda function */
|
|
20
32
|
lambdaInputTemplate?: string;
|
|
33
|
+
/** The maximum batching window in seconds before sending the batch */
|
|
21
34
|
sqsMaximumBatchingWindowInSeconds?: number;
|
|
22
35
|
}
|
|
23
36
|
/**
|
|
37
|
+
* Properties for creating an EventBridge rule using the L2 construct.
|
|
38
|
+
* @see {@link EBRuleProps}
|
|
24
39
|
*/
|
|
25
40
|
/** @category Interface */
|
|
26
41
|
export interface EventRuleProps extends EBRuleProps {
|
|
42
|
+
/** Optional tags to apply to the event rule */
|
|
27
43
|
tags?: TagProps[];
|
|
28
44
|
}
|
|
29
45
|
/**
|
|
46
|
+
* Properties for creating an EventBridge rule using the L1 CfnRule construct.
|
|
47
|
+
* @see {@link CfnRuleProps}
|
|
30
48
|
*/
|
|
31
49
|
/** @category Interface */
|
|
32
50
|
export interface RuleProps extends CfnRuleProps {
|
|
51
|
+
/** Optional input to pass to the rule targets */
|
|
33
52
|
input?: string;
|
|
53
|
+
/** Optional tags to apply to the rule */
|
|
34
54
|
tags?: TagProps[];
|
|
35
55
|
}
|
|
36
56
|
/**
|
|
57
|
+
* Properties for creating an EventBridge event bus.
|
|
58
|
+
* @see {@link EBProps}
|
|
37
59
|
*/
|
|
38
60
|
/** @category Interface */
|
|
39
61
|
export interface EventBusProps extends EBProps {
|
|
40
62
|
}
|
|
41
63
|
/**
|
|
42
|
-
|
|
64
|
+
* Properties for creating an EventBridge Pipe from a DynamoDB stream to a Lambda function.
|
|
65
|
+
* @see {@link CfnPipeProps}
|
|
43
66
|
*/
|
|
44
67
|
/** @category Interface */
|
|
45
68
|
export interface DynamoDbToLambdaPipeProps extends CfnPipeProps {
|
|
69
|
+
/** Optional filter pattern to apply to DynamoDB stream records before forwarding */
|
|
46
70
|
pipeFilterPattern?: any;
|
|
71
|
+
/** The maximum number of DynamoDB stream records to process in a single batch */
|
|
47
72
|
dynamoDbBatchSize?: number;
|
|
73
|
+
/** The position in the DynamoDB stream to start reading from (e.g. 'LATEST', 'TRIM_HORIZON') */
|
|
48
74
|
dynamoDbStartingPosition: string;
|
|
49
75
|
}
|
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
import { CfnExperimentProps, CfnFeatureProps, CfnLaunchProps, CfnProjectProps, CfnSegmentProps } from 'aws-cdk-lib/aws-evidently';
|
|
2
2
|
/**
|
|
3
|
+
* Properties for creating an Evidently project.
|
|
4
|
+
* @see {@link CfnProjectProps}
|
|
3
5
|
*/
|
|
4
6
|
/** @category Interface */
|
|
5
7
|
export interface EvidentlyProjectProps extends CfnProjectProps {
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
10
|
+
* Properties for creating an Evidently feature flag.
|
|
11
|
+
* @see {@link CfnFeatureProps}
|
|
8
12
|
*/
|
|
9
13
|
/** @category Interface */
|
|
10
14
|
export interface EvidentlyFeatureProps extends CfnFeatureProps {
|
|
11
15
|
}
|
|
12
16
|
/**
|
|
17
|
+
* Properties for creating an Evidently launch (gradual feature rollout).
|
|
18
|
+
* @see {@link CfnLaunchProps}
|
|
13
19
|
*/
|
|
14
20
|
/** @category Interface */
|
|
15
21
|
export interface EvidentlyLaunchProps extends CfnLaunchProps {
|
|
16
22
|
}
|
|
17
23
|
/**
|
|
24
|
+
* Properties for creating an Evidently experiment (A/B test).
|
|
25
|
+
* @see {@link CfnExperimentProps}
|
|
18
26
|
*/
|
|
19
27
|
/** @category Interface */
|
|
20
28
|
export interface EvidentlyExperimentProps extends CfnExperimentProps {
|
|
21
29
|
}
|
|
22
30
|
/**
|
|
31
|
+
* Properties for creating an Evidently audience segment.
|
|
32
|
+
* @see {@link CfnSegmentProps}
|
|
23
33
|
*/
|
|
24
34
|
/** @category Interface */
|
|
25
35
|
export interface EvidentlySegmentProps extends CfnSegmentProps {
|