@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
|
@@ -8,54 +8,88 @@ import { QueueProps } from '../simple-queue-service/index.js';
|
|
|
8
8
|
*/
|
|
9
9
|
/** @category Interface */
|
|
10
10
|
export interface EdgeFunctionProps extends FunctionProps {
|
|
11
|
+
/** Optional stack ID for the edge function's dedicated stack */
|
|
11
12
|
readonly stackId?: string;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
15
|
+
* Properties for configuring provisioned concurrency auto-scaling on a Lambda alias.
|
|
14
16
|
*/
|
|
15
17
|
/** @category Interface */
|
|
16
18
|
export interface ProvisionedConcurrencyProps {
|
|
19
|
+
/** Maximum number of provisioned concurrency instances to scale out to */
|
|
17
20
|
maxCapacity: number;
|
|
21
|
+
/** Minimum number of provisioned concurrency instances to maintain */
|
|
18
22
|
minCapacity: number;
|
|
23
|
+
/** Target utilization percentage to trigger scaling (0-1) */
|
|
19
24
|
utilizationTarget: number;
|
|
20
25
|
}
|
|
21
26
|
/**
|
|
27
|
+
* Properties for creating a Lambda function.
|
|
28
|
+
* @see {@link FunctionProps}
|
|
22
29
|
*/
|
|
23
30
|
/** @category Interface */
|
|
24
31
|
export interface LambdaProps extends FunctionProps {
|
|
32
|
+
/** Optional dead letter queue configuration for failed invocations */
|
|
25
33
|
dlq?: QueueProps;
|
|
34
|
+
/** When true, excludes the last modified timestamp from asset hashing */
|
|
26
35
|
excludeLastModifiedTimestamp?: boolean;
|
|
36
|
+
/** Optional list of aliases to create for the function */
|
|
27
37
|
lambdaAliases?: LambdaAliasProps[];
|
|
38
|
+
/** The log level to set as an environment variable */
|
|
28
39
|
logLevel?: string;
|
|
40
|
+
/** Log retention period in days */
|
|
29
41
|
logRetentionInDays?: number;
|
|
42
|
+
/** Optional redrive queue configuration for reprocessing failed messages */
|
|
30
43
|
redriveq?: QueueProps;
|
|
44
|
+
/** Optional tags to apply to the Lambda function */
|
|
31
45
|
tags?: TagProps[];
|
|
46
|
+
/** Function timeout in seconds, defaults to 15 minutes */
|
|
32
47
|
timeoutInSecs?: number;
|
|
33
48
|
}
|
|
34
49
|
/**
|
|
50
|
+
* Properties for creating a Lambda function alias with optional provisioned concurrency.
|
|
51
|
+
* @see {@link AliasProps}
|
|
35
52
|
*/
|
|
36
53
|
/** @category Interface */
|
|
37
54
|
export interface LambdaAliasProps extends AliasProps {
|
|
55
|
+
/** Optional custom logical ID for the alias resource */
|
|
38
56
|
id?: string;
|
|
57
|
+
/** Optional provisioned concurrency auto-scaling configuration */
|
|
39
58
|
provisionedConcurrency?: ProvisionedConcurrencyProps;
|
|
40
59
|
}
|
|
41
60
|
/**
|
|
61
|
+
* Properties for creating a Lambda@Edge function.
|
|
62
|
+
* @see {@link EdgeFunctionProps}
|
|
42
63
|
*/
|
|
43
64
|
/** @category Interface */
|
|
44
65
|
export interface LambdaEdgeProps extends EdgeFunctionProps {
|
|
66
|
+
/** Optional tags to apply to the edge function */
|
|
45
67
|
tags?: TagProps[];
|
|
68
|
+
/** Function timeout in seconds, defaults to 1 minute */
|
|
46
69
|
timeoutInSecs?: number;
|
|
47
70
|
}
|
|
48
71
|
/**
|
|
72
|
+
* Standard environment variables injected into Lambda functions.
|
|
49
73
|
*/
|
|
50
74
|
/** @category Interface */
|
|
51
75
|
export interface LambdaEnvironment {
|
|
76
|
+
/** The application log level (e.g. 'debug', 'info', 'warn', 'error') */
|
|
52
77
|
LOG_LEVEL: string;
|
|
78
|
+
/** The Node.js environment (e.g. 'production', 'development') */
|
|
53
79
|
NODE_ENV: string;
|
|
80
|
+
/** Optional AWS region override */
|
|
54
81
|
REGION?: string;
|
|
82
|
+
/** Optional deployment stage (e.g. 'dev', 'staging', 'prod') */
|
|
55
83
|
STAGE?: string;
|
|
84
|
+
/** The timezone for the function runtime */
|
|
56
85
|
TZ: string;
|
|
57
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Properties for configuring an SQS event source for a Lambda function.
|
|
89
|
+
* @see {@link SqsEventSourceProps}
|
|
90
|
+
*/
|
|
58
91
|
/** @category Interface */
|
|
59
92
|
export interface SQSEventSourceProps extends SqsEventSourceProps {
|
|
93
|
+
/** The maximum batching window in seconds before invoking the function */
|
|
60
94
|
maxBatchingWindowInSecs: number;
|
|
61
95
|
}
|
|
@@ -81,6 +81,8 @@ export class Route53Manager {
|
|
|
81
81
|
throw new Error(`Distribution undefined for ${id}`);
|
|
82
82
|
if (!hostedZone)
|
|
83
83
|
throw new Error(`HostedZone undefined for ${id}`);
|
|
84
|
+
/* In production or when skipStageFromRecord is set, use the plain record name;
|
|
85
|
+
otherwise append the stage suffix for environment isolation */
|
|
84
86
|
const aRecord = new ARecord(scope, `${id}`, {
|
|
85
87
|
recordName: (recordName && scope.isProductionStage()) || skipStageFromRecord
|
|
86
88
|
? `${recordName}`
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { HostedZoneProps } from 'aws-cdk-lib/aws-route53';
|
|
2
2
|
/**
|
|
3
|
+
* Properties for configuring an AWS Route53 hosted zone.
|
|
4
|
+
* @see [CDK Route53 Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53-readme.html}
|
|
3
5
|
*/
|
|
4
6
|
/** @category Interface */
|
|
5
7
|
export interface Route53Props extends HostedZoneProps {
|
|
8
|
+
/** Whether to look up an existing hosted zone instead of creating a new one */
|
|
6
9
|
useExistingHostedZone?: boolean;
|
|
7
10
|
}
|
|
@@ -56,6 +56,7 @@ export class SecretsManager {
|
|
|
56
56
|
* @param secretKey the secret key to resolve the value for
|
|
57
57
|
*/
|
|
58
58
|
async resolveSecretValue(region, secretId, secretKey) {
|
|
59
|
+
/* Create an SDK client using the credentials resolved from the environment/profile */
|
|
59
60
|
const client = new SecretsManagerClient({
|
|
60
61
|
credentials: determineCredentials(),
|
|
61
62
|
region,
|
|
@@ -66,6 +67,7 @@ export class SecretsManager {
|
|
|
66
67
|
const response = await client.send(command);
|
|
67
68
|
if (!response.SecretString)
|
|
68
69
|
throw new Error(`Unable to resolve secret for ${secretId}`);
|
|
70
|
+
/* Parse the secret JSON string and extract the requested key */
|
|
69
71
|
const secretString = JSON.parse(response.SecretString);
|
|
70
72
|
return secretString[secretKey];
|
|
71
73
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { SecretProps } from 'aws-cdk-lib/aws-secretsmanager';
|
|
2
|
+
/**
|
|
3
|
+
* Properties for configuring an AWS Secrets Manager secret.
|
|
4
|
+
* @see [CDK Secrets Manager Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager-readme.html}
|
|
5
|
+
*/
|
|
2
6
|
/** @category Interface */
|
|
3
7
|
export interface SecretBaseProps extends SecretProps {
|
|
4
8
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { TopicProps } from 'aws-cdk-lib/aws-sns';
|
|
2
2
|
/**
|
|
3
|
+
* Properties for configuring an AWS SNS topic subscription.
|
|
4
|
+
* @see [CDK SNS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sns-readme.html}
|
|
3
5
|
*/
|
|
4
6
|
/** @category Interface */
|
|
5
7
|
export interface SubscriptionProps extends TopicProps {
|
|
@@ -86,6 +86,8 @@ export class SqsManager {
|
|
|
86
86
|
* @param deadLetterQueue
|
|
87
87
|
*/
|
|
88
88
|
createDeadLetterQueueForLambda(id, scope, props, deadLetterQueue) {
|
|
89
|
+
/* Merge any DLQ-specific config from the lambda props, falling back to
|
|
90
|
+
a minimal config with just the queue name derived from the function name */
|
|
89
91
|
let queueProps;
|
|
90
92
|
if (props.dlq) {
|
|
91
93
|
queueProps = {
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
2
2
|
import { TagProps } from '../../types/index.js';
|
|
3
3
|
/**
|
|
4
|
+
* Properties for configuring an AWS SQS queue.
|
|
5
|
+
* @see [CDK SQS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs-readme.html}
|
|
4
6
|
*/
|
|
5
7
|
/** @category Interface */
|
|
6
8
|
export interface QueueProps extends sqs.QueueProps {
|
|
9
|
+
/** Duration in seconds for which the data key is reused before calling KMS again */
|
|
7
10
|
dataKeyReuseInSecs?: number;
|
|
11
|
+
/** Delay in seconds before messages become visible after being sent */
|
|
8
12
|
deliveryDelayInSecs?: number;
|
|
13
|
+
/** Maximum number of times a message can be received before being sent to the dead letter queue */
|
|
9
14
|
maxReceiveCount?: number;
|
|
15
|
+
/** Duration in seconds for which a receive call waits for a message to arrive */
|
|
10
16
|
receiveMessageWaitTimeInSecs?: number;
|
|
17
|
+
/** Number of days the queue retains messages */
|
|
11
18
|
retentionInDays?: number;
|
|
19
|
+
/** Whether retries are enabled for the dead letter queue */
|
|
12
20
|
retriesEnabled?: boolean;
|
|
21
|
+
/** Batch size for retry processing from the dead letter queue */
|
|
13
22
|
retryBatchSize?: number;
|
|
23
|
+
/** Tags to apply to the queue */
|
|
14
24
|
tags?: TagProps[];
|
|
25
|
+
/** Duration in seconds that a received message is hidden from subsequent receive requests */
|
|
15
26
|
visibilityTimeoutInSecs?: number;
|
|
16
27
|
}
|
|
@@ -70,7 +70,7 @@ export declare class S3Manager {
|
|
|
70
70
|
*/
|
|
71
71
|
doBucketDeployment(id: string, scope: CommonConstruct, siteBucket: IBucket, distribution: IDistribution, sources: ISource[], prefix: string, prune?: boolean): void;
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* @summary Method to create placeholder folders in an S3 bucket
|
|
74
74
|
* @param id scoped id of the resource
|
|
75
75
|
* @param scope scope in which this resource is defined
|
|
76
76
|
* @param bucket bucket to create the folders in
|
|
@@ -88,10 +88,12 @@ export class S3Manager {
|
|
|
88
88
|
throw new Error(`S3 props undefined for ${id}`);
|
|
89
89
|
let bucket;
|
|
90
90
|
const bucketName = S3Manager.determineBucketName(scope, props, props.bucketName);
|
|
91
|
+
/* Import an existing bucket by name instead of creating a new one */
|
|
91
92
|
if (props.existingBucket && props.bucketName) {
|
|
92
93
|
bucket = Bucket.fromBucketName(scope, `${id}`, S3Manager.determineBucketName(scope, props, props.bucketName));
|
|
93
94
|
}
|
|
94
95
|
else {
|
|
96
|
+
/* Optionally look up a separate bucket for server access logging */
|
|
95
97
|
let logBucket;
|
|
96
98
|
if (props.logBucketName) {
|
|
97
99
|
logBucket = Bucket.fromBucketName(scope, `${id}-logs`, S3Manager.determineBucketName(scope, props, props.logBucketName));
|
|
@@ -105,6 +107,8 @@ export class S3Manager {
|
|
|
105
107
|
removalPolicy: props.removalPolicy || RemovalPolicy.RETAIN,
|
|
106
108
|
serverAccessLogsBucket: logBucket,
|
|
107
109
|
});
|
|
110
|
+
/* Enable EventBridge notifications at the L1 (CloudFormation) level,
|
|
111
|
+
since the L2 Bucket construct does not expose this setting directly */
|
|
108
112
|
const cfnBucket = bucket.node.defaultChild;
|
|
109
113
|
cfnBucket.notificationConfiguration = {
|
|
110
114
|
eventBridgeConfiguration: {
|
|
@@ -174,7 +178,7 @@ export class S3Manager {
|
|
|
174
178
|
});
|
|
175
179
|
}
|
|
176
180
|
/**
|
|
177
|
-
*
|
|
181
|
+
* @summary Method to create placeholder folders in an S3 bucket
|
|
178
182
|
* @param id scoped id of the resource
|
|
179
183
|
* @param scope scope in which this resource is defined
|
|
180
184
|
* @param bucket bucket to create the folders in
|
|
@@ -2,27 +2,43 @@ import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
|
2
2
|
import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
|
|
3
3
|
import { TagProps } from '../../types/index.js';
|
|
4
4
|
/**
|
|
5
|
+
* Properties for configuring an S3 bucket lifecycle rule with convenience duration fields.
|
|
6
|
+
* @see [CDK S3 Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3-readme.html}
|
|
5
7
|
*/
|
|
6
8
|
/** @category Interface */
|
|
7
9
|
export interface LifecycleRule extends s3.LifecycleRule {
|
|
10
|
+
/** Number of days after which objects expire */
|
|
8
11
|
expirationInDays?: number;
|
|
12
|
+
/** Number of days after which noncurrent object versions expire */
|
|
9
13
|
noncurrentVersionExpirationInDays?: number;
|
|
10
14
|
}
|
|
11
15
|
/**
|
|
16
|
+
* Properties for configuring an S3 bucket deployment with convenience duration fields.
|
|
17
|
+
* @see [CDK S3 Deployment Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3_deployment-readme.html}
|
|
12
18
|
*/
|
|
13
19
|
/** @category Interface */
|
|
14
20
|
export interface BucketDeploymentProps extends s3deploy.BucketDeploymentProps {
|
|
21
|
+
/** Number of days after which objects expire */
|
|
15
22
|
expirationInDays?: number;
|
|
23
|
+
/** Number of days after which noncurrent object versions expire */
|
|
16
24
|
noncurrentVersionExpirationInDays?: number;
|
|
17
25
|
}
|
|
18
26
|
/**
|
|
27
|
+
* Properties for configuring an AWS S3 bucket.
|
|
28
|
+
* @see [CDK S3 Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3-readme.html}
|
|
19
29
|
*/
|
|
20
30
|
/** @category Interface */
|
|
21
31
|
export interface S3BucketProps extends s3.BucketProps {
|
|
32
|
+
/** The name of the S3 bucket */
|
|
22
33
|
bucketName: string;
|
|
34
|
+
/** Whether to enable EventBridge notifications for bucket events */
|
|
23
35
|
enableEventBridge?: boolean;
|
|
36
|
+
/** Whether to reference an existing bucket rather than creating a new one */
|
|
24
37
|
existingBucket?: boolean;
|
|
38
|
+
/** Lifecycle rules for objects in the bucket */
|
|
25
39
|
lifecycleRules?: LifecycleRule[];
|
|
40
|
+
/** Name of an existing bucket to use for server access logging */
|
|
26
41
|
logBucketName?: string;
|
|
42
|
+
/** Tags to apply to the bucket */
|
|
27
43
|
tags?: TagProps[];
|
|
28
44
|
}
|
|
@@ -1,104 +1,158 @@
|
|
|
1
1
|
import { ChoiceProps, FailProps, MapProps, ParallelProps, PassProps, RetryProps, StateMachineProps, SucceedProps, WaitProps } from 'aws-cdk-lib/aws-stepfunctions';
|
|
2
2
|
import { CallApiGatewayRestApiEndpointProps, DynamoDeleteItemProps, DynamoGetItemProps, DynamoPutItemProps, LambdaInvokeProps, SqsSendMessageProps, StepFunctionsStartExecutionProps } from 'aws-cdk-lib/aws-stepfunctions-tasks';
|
|
3
3
|
/**
|
|
4
|
+
* Properties for configuring a Step Functions succeed state.
|
|
5
|
+
* @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
|
|
4
6
|
*/
|
|
5
7
|
/** @category Interface */
|
|
6
8
|
export interface SfnSucceedProps extends SucceedProps {
|
|
9
|
+
/** The name of the step */
|
|
7
10
|
name: string;
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
13
|
+
* Properties for configuring retry behaviour on a Step Functions step.
|
|
14
|
+
* @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
|
|
10
15
|
*/
|
|
11
16
|
/** @category Interface */
|
|
12
17
|
export interface SfnRetryProps extends RetryProps {
|
|
18
|
+
/** Interval in seconds between retries */
|
|
13
19
|
intervalInSecs: number;
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
22
|
+
* Properties for configuring a Step Functions fail state.
|
|
23
|
+
* @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
|
|
16
24
|
*/
|
|
17
25
|
/** @category Interface */
|
|
18
26
|
export interface SfnFailProps extends FailProps {
|
|
27
|
+
/** The name of the step */
|
|
19
28
|
name: string;
|
|
20
29
|
}
|
|
21
30
|
/**
|
|
31
|
+
* Properties for configuring a Step Functions pass state.
|
|
32
|
+
* @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
|
|
22
33
|
*/
|
|
23
34
|
/** @category Interface */
|
|
24
35
|
export interface SfnPassProps extends PassProps {
|
|
36
|
+
/** The name of the step */
|
|
25
37
|
name: string;
|
|
26
38
|
}
|
|
27
39
|
/**
|
|
40
|
+
* Properties for configuring a DynamoDB GetItem step in a Step Functions workflow.
|
|
41
|
+
* @see [CDK Step Functions Tasks Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks-readme.html}
|
|
28
42
|
*/
|
|
29
43
|
/** @category Interface */
|
|
30
44
|
export interface SfnDynamoGetItemProps extends DynamoGetItemProps {
|
|
45
|
+
/** The name of the step */
|
|
31
46
|
name: string;
|
|
47
|
+
/** Retry configuration for the step */
|
|
32
48
|
retries?: SfnRetryProps[];
|
|
33
49
|
}
|
|
34
50
|
/**
|
|
51
|
+
* Properties for configuring a DynamoDB PutItem step in a Step Functions workflow.
|
|
52
|
+
* @see [CDK Step Functions Tasks Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks-readme.html}
|
|
35
53
|
*/
|
|
36
54
|
/** @category Interface */
|
|
37
55
|
export interface SfnDynamoPutItemProps extends DynamoPutItemProps {
|
|
56
|
+
/** The name of the step */
|
|
38
57
|
name: string;
|
|
58
|
+
/** Retry configuration for the step */
|
|
39
59
|
retries?: SfnRetryProps[];
|
|
40
60
|
}
|
|
41
61
|
/**
|
|
62
|
+
* Properties for configuring a DynamoDB DeleteItem step in a Step Functions workflow.
|
|
63
|
+
* @see [CDK Step Functions Tasks Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks-readme.html}
|
|
42
64
|
*/
|
|
43
65
|
/** @category Interface */
|
|
44
66
|
export interface SfnDynamoDeleteItemProps extends DynamoDeleteItemProps {
|
|
67
|
+
/** The name of the step */
|
|
45
68
|
name: string;
|
|
69
|
+
/** Retry configuration for the step */
|
|
46
70
|
retries?: SfnRetryProps[];
|
|
47
71
|
}
|
|
48
72
|
/**
|
|
73
|
+
* Properties for configuring an SQS SendMessage step in a Step Functions workflow.
|
|
74
|
+
* @see [CDK Step Functions Tasks Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks-readme.html}
|
|
49
75
|
*/
|
|
50
76
|
/** @category Interface */
|
|
51
77
|
export interface SfnSqsSendMessageProps extends SqsSendMessageProps {
|
|
78
|
+
/** The name of the step */
|
|
52
79
|
name: string;
|
|
80
|
+
/** Retry configuration for the step */
|
|
53
81
|
retries?: SfnRetryProps[];
|
|
54
82
|
}
|
|
55
83
|
/**
|
|
84
|
+
* Properties for configuring a Step Functions parallel state.
|
|
85
|
+
* @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
|
|
56
86
|
*/
|
|
57
87
|
/** @category Interface */
|
|
58
88
|
export interface SfnParallelProps extends ParallelProps {
|
|
89
|
+
/** The name of the step */
|
|
59
90
|
name: string;
|
|
91
|
+
/** Retry configuration for the step */
|
|
60
92
|
retries?: SfnRetryProps[];
|
|
61
93
|
}
|
|
62
94
|
/**
|
|
95
|
+
* Properties for configuring a Step Functions choice state.
|
|
96
|
+
* @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
|
|
63
97
|
*/
|
|
64
98
|
/** @category Interface */
|
|
65
99
|
export interface SfnChoiceProps extends ChoiceProps {
|
|
100
|
+
/** The name of the step */
|
|
66
101
|
name: string;
|
|
67
102
|
}
|
|
68
103
|
/**
|
|
104
|
+
* Properties for configuring a Step Functions wait state.
|
|
105
|
+
* @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
|
|
69
106
|
*/
|
|
70
107
|
/** @category Interface */
|
|
71
108
|
export interface SfnWaitProps extends WaitProps {
|
|
109
|
+
/** The name of the step */
|
|
72
110
|
name: string;
|
|
111
|
+
/** Delay in seconds before proceeding to the next state */
|
|
73
112
|
delayInSeconds: number;
|
|
74
113
|
}
|
|
75
114
|
/**
|
|
115
|
+
* Properties for configuring a Lambda invoke step in a Step Functions workflow.
|
|
116
|
+
* @see [CDK Step Functions Tasks Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks-readme.html}
|
|
76
117
|
*/
|
|
77
118
|
/** @category Interface */
|
|
78
119
|
export interface SfnLambdaInvokeProps extends LambdaInvokeProps {
|
|
120
|
+
/** The name of the step */
|
|
79
121
|
name: string;
|
|
122
|
+
/** Retry configuration for the step */
|
|
80
123
|
retries?: SfnRetryProps[];
|
|
81
124
|
}
|
|
82
125
|
/**
|
|
126
|
+
* Properties for configuring an API Gateway REST API endpoint call step in a Step Functions workflow.
|
|
127
|
+
* @see [CDK Step Functions Tasks Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks-readme.html}
|
|
83
128
|
*/
|
|
84
129
|
/** @category Interface */
|
|
85
130
|
export interface SfnCallApiGatewayRestApiEndpointProps extends CallApiGatewayRestApiEndpointProps {
|
|
131
|
+
/** The name of the step */
|
|
86
132
|
name: string;
|
|
133
|
+
/** Retry configuration for the step */
|
|
87
134
|
retries?: SfnRetryProps[];
|
|
88
135
|
}
|
|
89
136
|
/**
|
|
137
|
+
* Properties for configuring a Step Functions state machine.
|
|
138
|
+
* @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
|
|
90
139
|
*/
|
|
91
140
|
/** @category Interface */
|
|
92
141
|
export interface SfnStateMachineProps extends StateMachineProps {
|
|
93
142
|
}
|
|
94
143
|
/**
|
|
144
|
+
* Properties for configuring a Step Functions map state.
|
|
145
|
+
* @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
|
|
95
146
|
*/
|
|
96
147
|
/** @category Interface */
|
|
97
148
|
export interface SfnMapProps extends MapProps {
|
|
98
149
|
}
|
|
99
150
|
/**
|
|
151
|
+
* Properties for configuring a Step Functions start execution step.
|
|
152
|
+
* @see [CDK Step Functions Tasks Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks-readme.html}
|
|
100
153
|
*/
|
|
101
154
|
/** @category Interface */
|
|
102
155
|
export interface SfnStartExecutionProps extends StepFunctionsStartExecutionProps {
|
|
156
|
+
/** Retry configuration for the step */
|
|
103
157
|
retries?: SfnRetryProps[];
|
|
104
158
|
}
|
|
@@ -20,23 +20,24 @@ import { SSMParameterReaderProps, SSMStringParameterProps } from './types.js';
|
|
|
20
20
|
* @category Service
|
|
21
21
|
*/
|
|
22
22
|
export declare class SsmManager {
|
|
23
|
+
/** Parameter name used to store the last-modified timestamp for secrets */
|
|
23
24
|
static SECRETS_MODIFIED_TIMESTAMP_PARAM: string;
|
|
24
25
|
/**
|
|
25
|
-
* Method to write a string parameter to the parameters store
|
|
26
|
+
* @summary Method to write a string parameter to the parameters store
|
|
26
27
|
* @param id scoped id of the resource
|
|
27
28
|
* @param scope scope in which this resource is defined
|
|
28
29
|
* @param props parameter props
|
|
29
30
|
*/
|
|
30
31
|
writeStringToParameters(id: string, scope: CommonConstruct, props: SSMStringParameterProps): StringParameter;
|
|
31
32
|
/**
|
|
32
|
-
* Method to read a string parameter from the parameters store
|
|
33
|
+
* @summary Method to read a string parameter from the parameters store
|
|
33
34
|
* @param id scoped id of the resource
|
|
34
35
|
* @param scope scope in which this resource is defined
|
|
35
36
|
* @param parameterName parameter name to lookup
|
|
36
37
|
*/
|
|
37
38
|
readStringParameter(id: string, scope: CommonConstruct, parameterName: string): string;
|
|
38
39
|
/**
|
|
39
|
-
* Method to read a string parameter from the parameters store in a given region
|
|
40
|
+
* @summary Method to read a string parameter from the parameters store in a given region
|
|
40
41
|
* @param id scoped id of the resource
|
|
41
42
|
* @param scope scope in which this resource is defined
|
|
42
43
|
* @param parameterName parameter name to lookup
|
|
@@ -45,10 +46,20 @@ export declare class SsmManager {
|
|
|
45
46
|
readStringParameterFromRegion(id: string, scope: CommonConstruct, parameterName: string, region: string): string;
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
|
-
* Provides utilities to read same/cross region SSM parameters
|
|
49
|
+
* Provides utilities to read same/cross region SSM parameters.
|
|
50
|
+
*
|
|
51
|
+
* Uses an {@link AwsCustomResource} backed by the SSM SDK to read
|
|
52
|
+
* parameters from any region, including cross-region lookups that
|
|
53
|
+
* the standard CDK SSM constructs do not support.
|
|
49
54
|
* @category Service
|
|
50
55
|
*/
|
|
51
56
|
export declare class SSMParameterReader extends AwsCustomResource {
|
|
57
|
+
/**
|
|
58
|
+
* @summary Creates a custom resource that reads an SSM parameter
|
|
59
|
+
* @param scope scope in which this resource is defined
|
|
60
|
+
* @param name scoped id of the resource
|
|
61
|
+
* @param props the parameter reader configuration including name and region
|
|
62
|
+
*/
|
|
52
63
|
constructor(scope: CommonConstruct, name: string, props: SSMParameterReaderProps);
|
|
53
64
|
/**
|
|
54
65
|
* @summary Method to retrieve the SSM parameter value from the custom resource response
|
|
@@ -19,9 +19,10 @@ import { createCfnOutput } from '../../utils/index.js';
|
|
|
19
19
|
* @category Service
|
|
20
20
|
*/
|
|
21
21
|
export class SsmManager {
|
|
22
|
+
/** Parameter name used to store the last-modified timestamp for secrets */
|
|
22
23
|
static SECRETS_MODIFIED_TIMESTAMP_PARAM = 'secrets-last-modified-timestamp';
|
|
23
24
|
/**
|
|
24
|
-
* Method to write a string parameter to the parameters store
|
|
25
|
+
* @summary Method to write a string parameter to the parameters store
|
|
25
26
|
* @param id scoped id of the resource
|
|
26
27
|
* @param scope scope in which this resource is defined
|
|
27
28
|
* @param props parameter props
|
|
@@ -41,7 +42,7 @@ export class SsmManager {
|
|
|
41
42
|
return parameter;
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
|
-
* Method to read a string parameter from the parameters store
|
|
45
|
+
* @summary Method to read a string parameter from the parameters store
|
|
45
46
|
* @param id scoped id of the resource
|
|
46
47
|
* @param scope scope in which this resource is defined
|
|
47
48
|
* @param parameterName parameter name to lookup
|
|
@@ -52,7 +53,7 @@ export class SsmManager {
|
|
|
52
53
|
return StringParameter.valueFromLookup(scope, scope.resourceNameFormatter.format(parameterName, scope.props.resourceNameOptions?.ssm));
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
55
|
-
* Method to read a string parameter from the parameters store in a given region
|
|
56
|
+
* @summary Method to read a string parameter from the parameters store in a given region
|
|
56
57
|
* @param id scoped id of the resource
|
|
57
58
|
* @param scope scope in which this resource is defined
|
|
58
59
|
* @param parameterName parameter name to lookup
|
|
@@ -70,12 +71,24 @@ export class SsmManager {
|
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
/**
|
|
73
|
-
* Provides utilities to read same/cross region SSM parameters
|
|
74
|
+
* Provides utilities to read same/cross region SSM parameters.
|
|
75
|
+
*
|
|
76
|
+
* Uses an {@link AwsCustomResource} backed by the SSM SDK to read
|
|
77
|
+
* parameters from any region, including cross-region lookups that
|
|
78
|
+
* the standard CDK SSM constructs do not support.
|
|
74
79
|
* @category Service
|
|
75
80
|
*/
|
|
76
81
|
export class SSMParameterReader extends AwsCustomResource {
|
|
82
|
+
/**
|
|
83
|
+
* @summary Creates a custom resource that reads an SSM parameter
|
|
84
|
+
* @param scope scope in which this resource is defined
|
|
85
|
+
* @param name scoped id of the resource
|
|
86
|
+
* @param props the parameter reader configuration including name and region
|
|
87
|
+
*/
|
|
77
88
|
constructor(scope, name, props) {
|
|
78
89
|
const { parameterName, region } = props;
|
|
90
|
+
/* Build the SDK call to GetParameter, using a timestamp-based physical
|
|
91
|
+
resource ID so CloudFormation re-reads the value on every update */
|
|
79
92
|
const ssmAwsSdkCall = {
|
|
80
93
|
action: 'getParameter',
|
|
81
94
|
parameters: {
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { StringParameterProps } from 'aws-cdk-lib/aws-ssm';
|
|
2
2
|
/**
|
|
3
|
+
* Properties for reading an SSM parameter, optionally from a cross-region parameter store.
|
|
4
|
+
* @see [CDK SSM Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ssm-readme.html}
|
|
3
5
|
*/
|
|
4
6
|
/** @category Interface */
|
|
5
7
|
export interface SSMParameterReaderProps {
|
|
8
|
+
/** The name of the SSM parameter to read */
|
|
6
9
|
parameterName: string;
|
|
10
|
+
/** The AWS region from which to read the parameter */
|
|
7
11
|
region: string;
|
|
8
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Properties for configuring an AWS Systems Manager string parameter.
|
|
15
|
+
* @see [CDK SSM Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ssm-readme.html}
|
|
16
|
+
*/
|
|
9
17
|
/** @category Interface */
|
|
10
18
|
export interface SSMStringParameterProps extends StringParameterProps {
|
|
11
19
|
}
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import { Vpc } from 'aws-cdk-lib/aws-ec2';
|
|
2
2
|
import { CommonConstruct } from '../../common/index.js';
|
|
3
3
|
import { VpcProps } from './types.js';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* A VPC construct that provisions an IPv6-native VPC with dual-stack subnets.
|
|
6
|
+
*
|
|
7
|
+
* This construct extends the standard CDK {@link Vpc} to:
|
|
8
|
+
* - Associate an Amazon-provided IPv6 CIDR block with the VPC
|
|
9
|
+
* - Convert all subnets (public, private, isolated) to IPv6-native mode
|
|
10
|
+
* - Add default IPv6 routes via the Internet Gateway (public subnets) and
|
|
11
|
+
* an Egress-Only Internet Gateway (private subnets)
|
|
12
|
+
*
|
|
13
|
+
* @see [CDK VPC Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2-readme.html}
|
|
14
|
+
* @category Service
|
|
15
|
+
*/
|
|
5
16
|
export declare class Ipv6Vpc extends Vpc {
|
|
17
|
+
/** The ID of the egress-only internet gateway created for private subnets */
|
|
6
18
|
egressOnlyInternetGatewayId: string;
|
|
19
|
+
/**
|
|
20
|
+
* @summary Creates an IPv6-native VPC with dual-stack subnets
|
|
21
|
+
* @param scope scope in which this resource is defined
|
|
22
|
+
* @param id scoped id of the resource
|
|
23
|
+
* @param props VPC configuration properties
|
|
24
|
+
*/
|
|
7
25
|
constructor(scope: CommonConstruct, id: string, props: VpcProps);
|
|
8
26
|
}
|
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
import { Fn } from 'aws-cdk-lib';
|
|
2
2
|
import { CfnEgressOnlyInternetGateway, CfnVPCCidrBlock, RouterType, Vpc, } from 'aws-cdk-lib/aws-ec2';
|
|
3
3
|
import _ from 'lodash';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* A VPC construct that provisions an IPv6-native VPC with dual-stack subnets.
|
|
6
|
+
*
|
|
7
|
+
* This construct extends the standard CDK {@link Vpc} to:
|
|
8
|
+
* - Associate an Amazon-provided IPv6 CIDR block with the VPC
|
|
9
|
+
* - Convert all subnets (public, private, isolated) to IPv6-native mode
|
|
10
|
+
* - Add default IPv6 routes via the Internet Gateway (public subnets) and
|
|
11
|
+
* an Egress-Only Internet Gateway (private subnets)
|
|
12
|
+
*
|
|
13
|
+
* @see [CDK VPC Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2-readme.html}
|
|
14
|
+
* @category Service
|
|
15
|
+
*/
|
|
5
16
|
export class Ipv6Vpc extends Vpc {
|
|
17
|
+
/** The ID of the egress-only internet gateway created for private subnets */
|
|
6
18
|
egressOnlyInternetGatewayId;
|
|
19
|
+
/**
|
|
20
|
+
* @summary Creates an IPv6-native VPC with dual-stack subnets
|
|
21
|
+
* @param scope scope in which this resource is defined
|
|
22
|
+
* @param id scoped id of the resource
|
|
23
|
+
* @param props VPC configuration properties
|
|
24
|
+
*/
|
|
7
25
|
constructor(scope, id, props) {
|
|
8
26
|
super(scope, id, props);
|
|
27
|
+
/* Associate an Amazon-provided IPv6 CIDR block with this VPC */
|
|
9
28
|
const cfnVpcCidrBlock = new CfnVPCCidrBlock(this, `${id}-ipv6-cidr`, {
|
|
10
29
|
amazonProvidedIpv6CidrBlock: true,
|
|
11
30
|
vpcId: this.vpcId,
|
|
12
31
|
});
|
|
32
|
+
/* Divide the VPC IPv6 CIDR into /64 subnet blocks (max 256 subnets) */
|
|
13
33
|
const subnetIpv6CidrBlocks = Fn.cidr(Fn.select(0, this.vpcIpv6CidrBlocks), 256, '64');
|
|
34
|
+
/* Convert each subnet to IPv6-native mode: remove IPv4 CIDR, assign an IPv6 CIDR,
|
|
35
|
+
disable public IPv4 auto-assignment, and enable IPv6 address auto-assignment */
|
|
14
36
|
_.forEach([...this.publicSubnets, ...this.privateSubnets, ...this.isolatedSubnets], (subnet, index) => {
|
|
15
37
|
subnet.node.addDependency(cfnVpcCidrBlock);
|
|
16
38
|
const cfnSubnet = subnet.node.defaultChild;
|
|
@@ -20,18 +42,21 @@ export class Ipv6Vpc extends Vpc {
|
|
|
20
42
|
cfnSubnet.assignIpv6AddressOnCreation = true;
|
|
21
43
|
cfnSubnet.ipv6Native = true;
|
|
22
44
|
});
|
|
45
|
+
/* Helper to add a default IPv6 route (::/0) to all subnets via the specified gateway */
|
|
23
46
|
const addDefaultIpv6Routes = (subnets, gatewayId, routerType) => subnets.forEach(subnet => subnet.addRoute(`${id}-default-route`, {
|
|
24
47
|
destinationIpv6CidrBlock: '::/0',
|
|
25
48
|
enablesInternetConnectivity: true,
|
|
26
49
|
routerId: gatewayId,
|
|
27
50
|
routerType: routerType,
|
|
28
51
|
}));
|
|
52
|
+
/* Public subnets route IPv6 traffic through the Internet Gateway */
|
|
29
53
|
if (this.internetGatewayId) {
|
|
30
54
|
addDefaultIpv6Routes(this.publicSubnets, this.internetGatewayId, RouterType.GATEWAY);
|
|
31
55
|
}
|
|
32
56
|
if (_.isEmpty(this.privateSubnets)) {
|
|
33
57
|
return;
|
|
34
58
|
}
|
|
59
|
+
/* Private subnets use an Egress-Only Internet Gateway for outbound-only IPv6 access */
|
|
35
60
|
const egressIgw = new CfnEgressOnlyInternetGateway(this, `${id}-eigw`, { vpcId: this.vpcId });
|
|
36
61
|
this.egressOnlyInternetGatewayId = egressIgw.ref;
|
|
37
62
|
addDefaultIpv6Routes(this.privateSubnets, egressIgw.ref, RouterType.EGRESS_ONLY_INTERNET_GATEWAY);
|
|
@@ -3,8 +3,7 @@ import { SubnetType, Vpc } from 'aws-cdk-lib/aws-ec2';
|
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
import { createCfnOutput } from '../../utils/index.js';
|
|
5
5
|
import { Ipv6Vpc } from './ipv6.js';
|
|
6
|
-
/**
|
|
7
|
-
*/
|
|
6
|
+
/** Default identifier used for the common/shared VPC when no custom identifier is specified */
|
|
8
7
|
const CommonVpcIdentifier = 'CommonVpc';
|
|
9
8
|
/**
|
|
10
9
|
* Provides operations on AWS VPC.
|