konokenj.cdk-api-mcp-server 0.51.0__py3-none-any.whl → 0.53.0__py3-none-any.whl

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.

Potentially problematic release.


This version of konokenj.cdk-api-mcp-server might be problematic. Click here for more details.

Files changed (46) hide show
  1. cdk_api_mcp_server/__about__.py +1 -1
  2. cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-bedrock-agentcore-alpha/README.md +325 -3
  3. cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-lambda-go-alpha/README.md +102 -4
  4. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/README.md +9 -0
  5. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/integ.spec-restapi.ts +1 -0
  6. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/README.md +93 -81
  7. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.stage.ts +20 -4
  8. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/README.md +0 -1
  9. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-iam/integ.managed-policy.ts +9 -0
  10. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-iam/integ.policy.ts +9 -0
  11. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/README.md +60 -3
  12. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.cloudwatch-logs-processors.ts +45 -0
  13. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime.fromasset.ts +19 -4
  14. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime.inlinecode.ts +7 -0
  15. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/README.md +65 -4
  16. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-big-response.ts +13 -6
  17. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cloudfront.ts +20 -18
  18. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cross-nested-stack-source.ts +7 -1
  19. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cross-stack-source.ts +6 -1
  20. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cross-stack-ssm-source.ts +7 -1
  21. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-data.ts +83 -62
  22. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-deployed-bucket.ts +10 -4
  23. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-large-file.ts +20 -12
  24. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-loggroup.ts +7 -2
  25. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-efs.ts +77 -0
  26. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-empty.ts +69 -0
  27. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-multiple.ts +89 -0
  28. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-single.ts +77 -0
  29. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-signcontent.ts +11 -7
  30. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution-with-destination-key.ts +15 -8
  31. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution-with-role.ts +29 -14
  32. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution.ts +16 -8
  33. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-basic.ts +65 -0
  34. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-config.ts +66 -0
  35. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-custom-subnets.ts +66 -0
  36. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-efs.ts +66 -0
  37. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-security-groups.ts +72 -0
  38. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-subnet-selection.ts +70 -0
  39. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment.ts +47 -69
  40. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions/integ.sm-jsonpath-with-distributed-map-jsonata.ts +105 -0
  41. cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +11 -11
  42. {konokenj_cdk_api_mcp_server-0.51.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/METADATA +2 -2
  43. {konokenj_cdk_api_mcp_server-0.51.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/RECORD +46 -34
  44. {konokenj_cdk_api_mcp_server-0.51.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/WHEEL +0 -0
  45. {konokenj_cdk_api_mcp_server-0.51.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/entry_points.txt +0 -0
  46. {konokenj_cdk_api_mcp_server-0.51.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/licenses/LICENSE.txt +0 -0
@@ -1,27 +1,29 @@
1
1
  import * as path from 'path';
2
2
  import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
3
+ import * as origins from 'aws-cdk-lib/aws-cloudfront-origins';
3
4
  import * as s3 from 'aws-cdk-lib/aws-s3';
4
5
  import * as cdk from 'aws-cdk-lib';
5
6
  import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
6
- import { IntegTest } from '@aws-cdk/integ-tests-alpha';
7
+ import * as integ from '@aws-cdk/integ-tests-alpha';
8
+ import { Construct } from 'constructs';
7
9
 
8
- class TestBucketDeployment extends cdk.Stack {
9
- constructor(scope: cdk.App, id: string) {
10
- super(scope, id);
10
+ /**
11
+ * Integration test for bucket deployment with CloudFront distribution invalidation:
12
+ * - Deploys files to S3 bucket behind CloudFront distribution
13
+ * - Tests that CloudFront cache invalidation works with bucket deployments
14
+ */
15
+ class TestBucketDeploymentCloudFront extends cdk.Stack {
16
+ constructor(scope: Construct, id: string, props?: cdk.StackProps) {
17
+ super(scope, id, props);
11
18
 
12
- const bucket = new s3.Bucket(this, 'Destination3', {
19
+ const bucket = new s3.Bucket(this, 'Destination', {
13
20
  removalPolicy: cdk.RemovalPolicy.DESTROY,
14
21
  autoDeleteObjects: true, // needed for integration test cleanup
15
22
  });
16
- const distribution = new cloudfront.CloudFrontWebDistribution(this, 'Distribution', {
17
- originConfigs: [
18
- {
19
- s3OriginSource: {
20
- s3BucketSource: bucket,
21
- },
22
- behaviors: [{ isDefaultBehavior: true }],
23
- },
24
- ],
23
+ const distribution = new cloudfront.Distribution(this, 'Distribution', {
24
+ defaultBehavior: {
25
+ origin: origins.S3BucketOrigin.withOriginAccessControl(bucket),
26
+ },
25
27
  });
26
28
 
27
29
  new s3deploy.BucketDeployment(this, 'DeployWithInvalidation', {
@@ -29,7 +31,7 @@ class TestBucketDeployment extends cdk.Stack {
29
31
  destinationBucket: bucket,
30
32
  distribution,
31
33
  distributionPaths: ['/images/*.png'],
32
- retainOnDelete: false, // default is true, which will block the integration test cleanup
34
+ retainOnDelete: false,
33
35
  });
34
36
  }
35
37
  }
@@ -41,10 +43,10 @@ const app = new cdk.App({
41
43
  },
42
44
  });
43
45
 
44
- const stack = new TestBucketDeployment(app, 'test-bucket-deployments-1');
46
+ const testCase = new TestBucketDeploymentCloudFront(app, 'test-bucket-deployment-cloudfront');
45
47
 
46
- new IntegTest(app, 'TestBucketDeploymentInteg', {
47
- testCases: [stack],
48
+ new integ.IntegTest(app, 'integ-test-bucket-deployment-cloudfront', {
49
+ testCases: [testCase],
48
50
  diffAssets: true,
49
51
  });
50
52
 
@@ -6,6 +6,12 @@ import * as integ from '@aws-cdk/integ-tests-alpha';
6
6
  import { ExpectedResult } from '@aws-cdk/integ-tests-alpha';
7
7
  import { Construct } from 'constructs';
8
8
 
9
+ /**
10
+ * Integration test for bucket deployment with cross-nested-stack references:
11
+ * - Tests that Source.jsonData() can use values from resources in nested stacks
12
+ * - Validates that cross-nested-stack token resolution works correctly
13
+ * - Tests token substitution across nested stack boundaries
14
+ */
9
15
  class ResourceNestedStack extends NestedStack {
10
16
  userPool: UserPool;
11
17
  constructor (scope: Construct, id: string, props: NestedStackProps = {}) {
@@ -23,7 +29,7 @@ class DeploymentNestedStack extends NestedStack {
23
29
  constructor (scope: Construct, id: string, props: DeploymentNestedStackProps) {
24
30
  super(scope, id, props);
25
31
  this.bucket = new Bucket(this, 'Bucket');
26
- new BucketDeployment(this, 'Deployment', {
32
+ new BucketDeployment(this, 'DeployWithCrossNestedStackSource', {
27
33
  destinationBucket: this.bucket,
28
34
  sources: [
29
35
  Source.jsonData('appconfig.json', { userPoolId: props.userPool.userPoolId }),
@@ -6,6 +6,11 @@ import { Construct } from 'constructs';
6
6
  import { BucketDeployment, Source } from 'aws-cdk-lib/aws-s3-deployment';
7
7
  import { Bucket } from 'aws-cdk-lib/aws-s3';
8
8
 
9
+ /**
10
+ * Integration test for bucket deployment with cross-stack references:
11
+ * - Tests that Source.data() can use values from resources in other stacks
12
+ * - Validates that cross-stack token resolution works correctly
13
+ */
9
14
  class Stack2 extends Stack {
10
15
  userPool: UserPool;
11
16
 
@@ -21,7 +26,7 @@ class Stack1 extends Stack {
21
26
  constructor (scope: Construct, id: string, props: { userPool: UserPool }) {
22
27
  super(scope, id);
23
28
  this.bucket = new Bucket(this, 'bucket');
24
- new BucketDeployment(this, 'XXXXXXXXXX', {
29
+ new BucketDeployment(this, 'DeployWithCrossStackSource', {
25
30
  destinationBucket: this.bucket,
26
31
  sources: [
27
32
  Source.data('test.txt', props.userPool.userPoolId),
@@ -5,6 +5,12 @@ import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
5
5
  import * as ssm from 'aws-cdk-lib/aws-ssm';
6
6
  import * as integ from '@aws-cdk/integ-tests-alpha';
7
7
 
8
+ /**
9
+ * Integration test for bucket deployment with cross-stack SSM parameter references:
10
+ * - Tests that SSM StringListParameter tokens are resolved in Source.jsonData()
11
+ * - Validates cross-nested-stack parameter references work correctly
12
+ * - Tests that parameter values are properly serialized in JSON output
13
+ */
8
14
  class SsmStack extends cdk.NestedStack {
9
15
  public readonly ssmParam: ssm.StringListParameter;
10
16
 
@@ -38,7 +44,7 @@ class S3Stack extends cdk.NestedStack {
38
44
  autoDeleteObjects: true,
39
45
  });
40
46
 
41
- new s3deploy.BucketDeployment(this, 'ReproDeployment', {
47
+ new s3deploy.BucketDeployment(this, 'DeployWithSsmParameter', {
42
48
  sources: [
43
49
  s3deploy.Source.jsonData('config.json', {
44
50
  subnets: readParam.stringListValue,
@@ -1,80 +1,101 @@
1
1
  import { Bucket } from 'aws-cdk-lib/aws-s3';
2
- import { App, CfnOutput, RemovalPolicy, Stack, Token } from 'aws-cdk-lib';
2
+ import { App, CfnOutput, RemovalPolicy, Stack, StackProps, Token } from 'aws-cdk-lib';
3
3
  import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
4
4
  import { BucketDeployment, Source } from 'aws-cdk-lib/aws-s3-deployment';
5
5
  import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
6
6
  import * as ssm from 'aws-cdk-lib/aws-ssm';
7
7
  import * as path from 'path';
8
+ import { Construct } from 'constructs';
8
9
 
9
- const app = new App({
10
- postCliContext: {
11
- '@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
12
- },
13
- });
14
- const stack = new Stack(app, 'TestBucketDeploymentContent');
15
- const bucket = new Bucket(stack, 'Bucket', {
16
- removalPolicy: RemovalPolicy.DESTROY, // Allow bucket deletion
17
- autoDeleteObjects: true, // Delete objects when bucket is deleted
18
- });
10
+ /**
11
+ * Integration test for bucket deployment with various data source types:
12
+ * - Tests Source.data(), Source.jsonData(), and Source.yamlData() methods
13
+ * - Validates token substitution in JSON and YAML files
14
+ * - Tests proper escaping of special characters (quotes) in JSON files
15
+ * - Tests addSource() method for dynamically adding sources
16
+ * - Validates empty string handling
17
+ */
18
+ class TestBucketDeploymentData extends Stack {
19
+ public readonly bucket: Bucket;
19
20
 
20
- const file1 = Source.data('file1.txt', 'boom');
21
- const file2 = Source.data('path/to/file2.txt', `bam! ${bucket.bucketName}`);
22
- const file3 = Source.jsonData('my-json/config.json', { website_url: bucket.bucketWebsiteUrl });
23
- const file4 = Source.yamlData('my-yaml/config.yaml', { website_url: bucket.bucketWebsiteUrl });
24
- const file5 = Source.jsonData('my-json/config2.json', { bucket_domain_name: bucket.bucketWebsiteDomainName });
25
-
26
- // Add new test case for secret value with quotes
27
- const secret = new secretsmanager.Secret(stack, 'TestSecret', {
28
- generateSecretString: {
29
- secretStringTemplate: JSON.stringify({
30
- value: 'test"with"quotes',
31
- }),
32
- generateStringKey: 'password',
33
- },
34
- });
21
+ constructor(scope: Construct, id: string, props?: StackProps) {
22
+ super(scope, id, props);
35
23
 
36
- // Store secret in SSM (workaround for #21503)
37
- const param = new ssm.StringParameter(stack, 'SecretParam', {
38
- stringValue: secret.secretValueFromJson('value').unsafeUnwrap(),
39
- });
24
+ this.bucket = new Bucket(this, 'Bucket', {
25
+ removalPolicy: RemovalPolicy.DESTROY,
26
+ autoDeleteObjects: true,
27
+ });
40
28
 
41
- const tokenizedValue = param.stringValue; // This should be a Token
42
- new CfnOutput(stack, 'IsToken', { value: Token.isUnresolved(tokenizedValue).toString() });
43
- new CfnOutput(stack, 'SecretValue', { value: tokenizedValue });
29
+ // Test various data source types with different content
30
+ const file1 = Source.data('file1.txt', 'boom');
31
+ const file2 = Source.data('path/to/file2.txt', `bam! ${this.bucket.bucketName}`);
32
+ const file3 = Source.jsonData('my-json/config.json', { website_url: this.bucket.bucketWebsiteUrl });
33
+ const file4 = Source.yamlData('my-yaml/config.yaml', { website_url: this.bucket.bucketWebsiteUrl });
34
+ const file5 = Source.jsonData('my-json/config2.json', { bucket_domain_name: this.bucket.bucketWebsiteDomainName });
44
35
 
45
- // Add new file with secret value that needs proper escaping
46
- const file6 = Source.jsonData('my-json/secret-config.json', {
47
- secret_value: tokenizedValue, // Using the tokenized value explicitly
48
- }, { escape: true });
49
- const file7 = Source.yamlData('my-yaml/secret-config.yaml', {
50
- secret_value: tokenizedValue,
51
- });
36
+ // Test secret value with quotes that need escaping
37
+ const secret = new secretsmanager.Secret(this, 'TestSecret', {
38
+ generateSecretString: {
39
+ secretStringTemplate: JSON.stringify({
40
+ value: 'test"with"quotes',
41
+ }),
42
+ generateStringKey: 'password',
43
+ },
44
+ });
52
45
 
53
- // case for empty string
54
- const file8 = Source.data('file8.txt', '');
46
+ // Store secret in SSM (workaround for #21503)
47
+ const param = new ssm.StringParameter(this, 'SecretParam', {
48
+ stringValue: secret.secretValueFromJson('value').unsafeUnwrap(),
49
+ });
55
50
 
56
- const deployment = new BucketDeployment(stack, 'DeployMeHere', {
57
- destinationBucket: bucket,
58
- sources: [file1, file2],
59
- destinationKeyPrefix: 'deploy/here/',
60
- retainOnDelete: false, // default is true, which will block the integration test cleanup
61
- });
62
- deployment.addSource(file3);
63
- deployment.addSource(file4);
64
- deployment.addSource(file5);
65
- deployment.addSource(file6);
66
- deployment.addSource(file7);
67
- deployment.addSource(file8);
51
+ const tokenizedValue = param.stringValue; // This should be a Token
52
+ new CfnOutput(this, 'IsToken', { value: Token.isUnresolved(tokenizedValue).toString() });
53
+ new CfnOutput(this, 'SecretValue', { value: tokenizedValue });
54
+
55
+ // Test proper escaping of quotes in JSON
56
+ const file6 = Source.jsonData('my-json/secret-config.json', {
57
+ secret_value: tokenizedValue,
58
+ }, { escape: true });
59
+ // Test YAML file (which doesn't require escaping)
60
+ const file7 = Source.yamlData('my-yaml/secret-config.yaml', {
61
+ secret_value: tokenizedValue,
62
+ });
63
+
64
+ // Test empty string handling
65
+ const file8 = Source.data('file8.txt', '');
66
+
67
+ const deployment = new BucketDeployment(this, 'DeployWithDataSources', {
68
+ destinationBucket: this.bucket,
69
+ sources: [file1, file2],
70
+ destinationKeyPrefix: 'deploy/here/',
71
+ retainOnDelete: false,
72
+ });
73
+ // Test addSource() method
74
+ deployment.addSource(file3);
75
+ deployment.addSource(file4);
76
+ deployment.addSource(file5);
77
+ deployment.addSource(file6);
78
+ deployment.addSource(file7);
79
+ deployment.addSource(file8);
80
+
81
+ new CfnOutput(this, 'BucketName', { value: this.bucket.bucketName });
82
+ }
83
+ }
68
84
 
69
- new CfnOutput(stack, 'BucketName', { value: bucket.bucketName });
85
+ const app = new App({
86
+ postCliContext: {
87
+ '@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
88
+ },
89
+ });
90
+ const testCase = new TestBucketDeploymentData(app, 'test-bucket-deployment-data');
70
91
 
71
- const integ = new IntegTest(app, 'integ-test-bucket-deployment-data', {
72
- testCases: [stack],
92
+ const integTest = new IntegTest(app, 'integ-test-bucket-deployment-data', {
93
+ testCases: [testCase],
73
94
  });
74
95
 
75
- // Add assertions to verify the JSON file
76
- const assertionProvider = integ.assertions.awsApiCall('S3', 'getObject', {
77
- Bucket: bucket.bucketName,
96
+ // Assert that addSource() successfully adds the data source alongside the asset source
97
+ const assertionProvider = integTest.assertions.awsApiCall('S3', 'getObject', {
98
+ Bucket: testCase.bucket.bucketName,
78
99
  Key: path.join('deploy/here', 'my-json/secret-config.json'),
79
100
  });
80
101
 
@@ -85,8 +106,8 @@ assertionProvider.expect(ExpectedResult.objectLike({
85
106
  }));
86
107
 
87
108
  // Add assertions to verify the YAML file
88
- const yamlAssertionProvider = integ.assertions.awsApiCall('S3', 'getObject', {
89
- Bucket: bucket.bucketName,
109
+ const yamlAssertionProvider = integTest.assertions.awsApiCall('S3', 'getObject', {
110
+ Bucket: testCase.bucket.bucketName,
90
111
  Key: path.join('deploy/here', 'my-yaml/secret-config.yaml'),
91
112
  });
92
113
 
@@ -5,6 +5,11 @@ import * as integ from '@aws-cdk/integ-tests-alpha';
5
5
  import { Construct } from 'constructs';
6
6
  import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
7
7
 
8
+ /**
9
+ * Integration test for deployedBucket property:
10
+ * - Tests that deployedBucket provides access to bucket after deployment completes
11
+ * - Validates that bucket properties like bucketWebsiteUrl can be accessed via deployedBucket
12
+ */
8
13
  class TestBucketDeployment extends cdk.Stack {
9
14
  public readonly bucket: s3.IBucket;
10
15
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
@@ -16,13 +21,14 @@ class TestBucketDeployment extends cdk.Stack {
16
21
  autoDeleteObjects: true, // needed for integration test cleanup
17
22
  });
18
23
 
19
- const deploy = new s3deploy.BucketDeployment(this, 'DeployMe5', {
24
+ const deployment = new s3deploy.BucketDeployment(this, 'DeployWithDeployedBucket', {
20
25
  sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website-second'))],
21
26
  destinationBucket: this.bucket,
22
- retainOnDelete: false, // default is true, which will block the integration test cleanup
27
+ retainOnDelete: false,
23
28
  });
24
29
 
25
- this.exportValue(deploy.deployedBucket.bucketWebsiteUrl, {
30
+ // Export the website URL accessed via deployedBucket property
31
+ this.exportValue(deployment.deployedBucket.bucketWebsiteUrl, {
26
32
  name: 'WebsiteUrl',
27
33
  });
28
34
  }
@@ -35,7 +41,7 @@ const app = new cdk.App({
35
41
  });
36
42
  const testCase = new TestBucketDeployment(app, 'test-bucket-deployment-deployed-bucket');
37
43
 
38
- new integ.IntegTest(app, 'integ-test-bucket-deployments', {
44
+ new integ.IntegTest(app, 'integ-test-bucket-deployment-deployed-bucket', {
39
45
  testCases: [testCase],
40
46
  diffAssets: true,
41
47
  });
@@ -10,15 +10,22 @@ import * as fs from 'fs';
10
10
  import * as crypto from 'crypto';
11
11
  import * as os from 'os';
12
12
 
13
+ /**
14
+ * Integration test for bucket deployment with large files:
15
+ * - Tests deployment of large files (10MB JSON and text files)
16
+ * - Validates that large file uploads work correctly
17
+ * - Tests token substitution and escaping in large deployments
18
+ * - Validates both escaped and unescaped JSON handling
19
+ */
13
20
  const app = new App({
14
21
  postCliContext: {
15
22
  '@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
16
23
  },
17
24
  });
18
- const stack = new Stack(app, 'TestBucketDeploymentLargeFile');
25
+ const stack = new Stack(app, 'test-bucket-deployment-large-file');
19
26
  const bucket = new Bucket(stack, 'Bucket', {
20
- removalPolicy: RemovalPolicy.DESTROY, // Allow bucket deletion
21
- autoDeleteObjects: true, // Delete objects when bucket is deleted
27
+ removalPolicy: RemovalPolicy.DESTROY,
28
+ autoDeleteObjects: true,
22
29
  });
23
30
 
24
31
  // Create a temporary directory for our large files
@@ -153,7 +160,7 @@ const noEscapeFileWithMarker = Source.jsonData('my-json/secret-config-no-escape.
153
160
  });
154
161
 
155
162
  // Deploy the large files
156
- new BucketDeployment(stack, 'DeployLargeFiles', {
163
+ new BucketDeployment(stack, 'DeployWithLargeFiles', {
157
164
  destinationBucket: bucket,
158
165
  sources: [largeJsonSource, largeTextSource, fileWithMarker, noEscapeFileWithMarker],
159
166
  retainOnDelete: false,
@@ -161,12 +168,12 @@ new BucketDeployment(stack, 'DeployLargeFiles', {
161
168
 
162
169
  new CfnOutput(stack, 'BucketName', { value: bucket.bucketName });
163
170
 
164
- const integ = new IntegTest(app, 'integ-test-bucket-deployment-large-file', {
171
+ const integTest = new IntegTest(app, 'integ-test-bucket-deployment-large-file', {
165
172
  testCases: [stack],
166
173
  });
167
174
 
168
- // Add assertions to verify the JSON file
169
- const assertionProvider = integ.assertions.awsApiCall('S3', 'getObject', {
175
+ // Assert that escaped JSON is properly escaped
176
+ const assertionProvider = integTest.assertions.awsApiCall('S3', 'getObject', {
170
177
  Bucket: bucket.bucketName,
171
178
  Key: 'my-json/secret-config.json',
172
179
  });
@@ -177,7 +184,8 @@ assertionProvider.expect(ExpectedResult.objectLike({
177
184
  Body: '{"secret_value":"test\\"with\\"quotes"}',
178
185
  }));
179
186
 
180
- integ.assertions.awsApiCall('S3', 'getObject', {
187
+ // Assert that unescaped JSON works without escape option
188
+ integTest.assertions.awsApiCall('S3', 'getObject', {
181
189
  Bucket: bucket.bucketName,
182
190
  Key: 'my-json/secret-config-no-escape.json',
183
191
  }).expect(ExpectedResult.objectLike({
@@ -185,8 +193,8 @@ integ.assertions.awsApiCall('S3', 'getObject', {
185
193
  Body: '{"secret_value":"test"with"quotes"}',
186
194
  }));
187
195
 
188
- // Verify the large JSON file was deployed successfully
189
- const jsonAssertionProvider = integ.assertions.awsApiCall('S3', 'listObjectsV2', {
196
+ // Assert that large JSON file was deployed successfully
197
+ const jsonAssertionProvider = integTest.assertions.awsApiCall('S3', 'listObjectsV2', {
190
198
  Bucket: bucket.bucketName,
191
199
  Prefix: 'large-file.json',
192
200
  MaxKeys: 1,
@@ -211,8 +219,8 @@ if (jsonAssertionProvider instanceof AwsApiCall && jsonAssertionProvider.waiterP
211
219
  });
212
220
  }
213
221
 
214
- // Verify the large text file was deployed successfully
215
- const textAssertionProvider = integ.assertions.awsApiCall('S3', 'listObjectsV2', {
222
+ // Assert that large text file was deployed successfully
223
+ const textAssertionProvider = integTest.assertions.awsApiCall('S3', 'listObjectsV2', {
216
224
  Bucket: bucket.bucketName,
217
225
  Prefix: 'large-file.txt',
218
226
  MaxKeys: 1,
@@ -6,6 +6,11 @@ import * as integ from '@aws-cdk/integ-tests-alpha';
6
6
  import { Construct } from 'constructs';
7
7
  import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
8
8
 
9
+ /**
10
+ * Integration test for bucket deployment with custom log group:
11
+ * - Lambda function writes logs to a custom CloudWatch Log Group
12
+ * - Tests that custom log groups work correctly with bucket deployments
13
+ */
9
14
  class TestBucketDeployment extends cdk.Stack {
10
15
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
11
16
  super(scope, id, props);
@@ -17,14 +22,14 @@ class TestBucketDeployment extends cdk.Stack {
17
22
  autoDeleteObjects: true, // needed for integration test cleanup
18
23
  });
19
24
 
20
- new s3deploy.BucketDeployment(this, 'DeployMe', {
25
+ new s3deploy.BucketDeployment(this, 'DeployWithCustomLogGroup', {
21
26
  sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))],
22
27
  destinationBucket,
23
28
  logGroup: new logs.LogGroup(this, 'LogGroup', {
24
29
  retention: logs.RetentionDays.ONE_DAY,
25
30
  removalPolicy: cdk.RemovalPolicy.DESTROY, // cleanup integ test
26
31
  }),
27
- retainOnDelete: false, // default is true, which will block the integration test cleanup
32
+ retainOnDelete: false,
28
33
  });
29
34
  }
30
35
  }
@@ -0,0 +1,77 @@
1
+ import * as path from 'path';
2
+ import * as ec2 from 'aws-cdk-lib/aws-ec2';
3
+ import * as s3 from 'aws-cdk-lib/aws-s3';
4
+ import * as cdk from 'aws-cdk-lib';
5
+ import * as integ from '@aws-cdk/integ-tests-alpha';
6
+ import { Construct } from 'constructs';
7
+ import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
8
+
9
+ /**
10
+ * Integration test for bucket deployment with security groups and EFS:
11
+ * - Lambda function runs in VPC with EFS filesystem and custom security group
12
+ * - Tests that security groups work correctly with EFS-enabled deployments
13
+ */
14
+ class TestBucketDeploymentSecurityGroupsEfs extends cdk.Stack {
15
+ constructor(scope: Construct, id: string, props?: cdk.StackProps) {
16
+ super(scope, id, props);
17
+
18
+ // Create a VPC inline instead of looking it up
19
+ // Use isolated subnets with S3 VPC endpoint - no NAT Gateway or Elastic IP needed
20
+ const vpc = new ec2.Vpc(this, 'TestVpc', {
21
+ restrictDefaultSecurityGroup: false,
22
+ natGateways: 0,
23
+ subnetConfiguration: [
24
+ {
25
+ cidrMask: 24,
26
+ name: 'Isolated',
27
+ subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
28
+ },
29
+ ],
30
+ });
31
+
32
+ // Add S3 Gateway endpoint so Lambda can access S3 without NAT Gateway
33
+ vpc.addGatewayEndpoint('S3Endpoint', {
34
+ service: ec2.GatewayVpcEndpointAwsService.S3,
35
+ });
36
+
37
+ // Create security group with allow all outbound
38
+ const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', {
39
+ vpc,
40
+ description: 'Security group - allow all outbound',
41
+ allowAllOutbound: true,
42
+ });
43
+
44
+ const destinationBucket = new s3.Bucket(this, 'Destination', {
45
+ websiteIndexDocument: 'index.html',
46
+ publicReadAccess: false,
47
+ removalPolicy: cdk.RemovalPolicy.DESTROY,
48
+ autoDeleteObjects: true, // needed for integration test cleanup
49
+ });
50
+
51
+ // Test deployment with EFS storage and security groups
52
+ new s3deploy.BucketDeployment(this, 'DeployWithEfsAndSecurityGroups', {
53
+ sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))],
54
+ destinationBucket,
55
+ destinationKeyPrefix: 'efs-sg/',
56
+ useEfs: true,
57
+ vpc,
58
+ securityGroups: [securityGroup],
59
+ retainOnDelete: false, // default is true, which will block the integration test cleanup
60
+ });
61
+ }
62
+ }
63
+
64
+ const app = new cdk.App({
65
+ postCliContext: {
66
+ '@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
67
+ },
68
+ });
69
+
70
+ const testCase = new TestBucketDeploymentSecurityGroupsEfs(app, 'test-bucket-deployment-security-groups-efs');
71
+
72
+ new integ.IntegTest(app, 'integ-test-bucket-deployment-security-groups-efs', {
73
+ testCases: [testCase],
74
+ diffAssets: false,
75
+ });
76
+
77
+ app.synth();
@@ -0,0 +1,69 @@
1
+ import * as path from 'path';
2
+ import * as ec2 from 'aws-cdk-lib/aws-ec2';
3
+ import * as s3 from 'aws-cdk-lib/aws-s3';
4
+ import * as cdk from 'aws-cdk-lib';
5
+ import * as integ from '@aws-cdk/integ-tests-alpha';
6
+ import { Construct } from 'constructs';
7
+ import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
8
+
9
+ /**
10
+ * Integration test for bucket deployment with empty security groups array:
11
+ * - Lambda function runs in VPC with explicitly empty security groups array
12
+ * - Tests that empty security groups array is handled correctly
13
+ */
14
+ class TestBucketDeploymentEmptySecurityGroups extends cdk.Stack {
15
+ constructor(scope: Construct, id: string, props?: cdk.StackProps) {
16
+ super(scope, id, props);
17
+
18
+ // Create a VPC inline instead of looking it up
19
+ // Use isolated subnets with S3 VPC endpoint - no NAT Gateway or Elastic IP needed
20
+ const vpc = new ec2.Vpc(this, 'TestVpc', {
21
+ restrictDefaultSecurityGroup: false,
22
+ natGateways: 0,
23
+ subnetConfiguration: [
24
+ {
25
+ cidrMask: 24,
26
+ name: 'Isolated',
27
+ subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
28
+ },
29
+ ],
30
+ });
31
+
32
+ // Add S3 Gateway endpoint so Lambda can access S3 without NAT Gateway
33
+ vpc.addGatewayEndpoint('S3Endpoint', {
34
+ service: ec2.GatewayVpcEndpointAwsService.S3,
35
+ });
36
+
37
+ const destinationBucket = new s3.Bucket(this, 'Destination', {
38
+ websiteIndexDocument: 'index.html',
39
+ publicReadAccess: false,
40
+ removalPolicy: cdk.RemovalPolicy.DESTROY,
41
+ autoDeleteObjects: true, // needed for integration test cleanup
42
+ });
43
+
44
+ // Test deployment with empty security groups array
45
+ new s3deploy.BucketDeployment(this, 'DeployWithEmptySecurityGroups', {
46
+ sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))],
47
+ destinationBucket,
48
+ destinationKeyPrefix: 'empty-sg/',
49
+ vpc,
50
+ securityGroups: [],
51
+ retainOnDelete: false, // default is true, which will block the integration test cleanup
52
+ });
53
+ }
54
+ }
55
+
56
+ const app = new cdk.App({
57
+ postCliContext: {
58
+ '@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
59
+ },
60
+ });
61
+
62
+ const testCase = new TestBucketDeploymentEmptySecurityGroups(app, 'test-bucket-deployment-security-groups-empty');
63
+
64
+ new integ.IntegTest(app, 'integ-test-bucket-deployment-security-groups-empty', {
65
+ testCases: [testCase],
66
+ diffAssets: false,
67
+ });
68
+
69
+ app.synth();