konokenj.cdk-api-mcp-server 0.52.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.
- cdk_api_mcp_server/__about__.py +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-lambda-go-alpha/README.md +102 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/README.md +0 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/README.md +65 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-big-response.ts +13 -6
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cloudfront.ts +20 -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
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cross-stack-source.ts +6 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cross-stack-ssm-source.ts +7 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-data.ts +83 -62
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-deployed-bucket.ts +10 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-large-file.ts +20 -12
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-loggroup.ts +7 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-efs.ts +77 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-empty.ts +69 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-multiple.ts +89 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-single.ts +77 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-signcontent.ts +11 -7
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution-with-destination-key.ts +15 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution-with-role.ts +29 -14
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution.ts +16 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-basic.ts +65 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-config.ts +66 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-custom-subnets.ts +66 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-efs.ts +66 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-security-groups.ts +72 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-subnet-selection.ts +70 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment.ts +47 -69
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions/integ.sm-jsonpath-with-distributed-map-jsonata.ts +105 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +2 -2
- {konokenj_cdk_api_mcp_server-0.52.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.52.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/RECORD +35 -24
- {konokenj_cdk_api_mcp_server-0.52.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/WHEEL +0 -0
- {konokenj_cdk_api_mcp_server-0.52.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.52.0.dist-info → konokenj_cdk_api_mcp_server-0.53.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -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
|
|
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,
|
|
27
|
+
retainOnDelete: false,
|
|
23
28
|
});
|
|
24
29
|
|
|
25
|
-
|
|
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-
|
|
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, '
|
|
25
|
+
const stack = new Stack(app, 'test-bucket-deployment-large-file');
|
|
19
26
|
const bucket = new Bucket(stack, 'Bucket', {
|
|
20
|
-
removalPolicy: RemovalPolicy.DESTROY,
|
|
21
|
-
autoDeleteObjects: true,
|
|
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, '
|
|
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
|
|
171
|
+
const integTest = new IntegTest(app, 'integ-test-bucket-deployment-large-file', {
|
|
165
172
|
testCases: [stack],
|
|
166
173
|
});
|
|
167
174
|
|
|
168
|
-
//
|
|
169
|
-
const assertionProvider =
|
|
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
|
-
|
|
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
|
-
//
|
|
189
|
-
const jsonAssertionProvider =
|
|
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
|
-
//
|
|
215
|
-
const textAssertionProvider =
|
|
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, '
|
|
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,
|
|
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();
|
|
@@ -0,0 +1,89 @@
|
|
|
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 multiple security groups:
|
|
11
|
+
* - Lambda function runs in VPC with multiple security groups attached
|
|
12
|
+
* - Tests that deployments work with multiple security groups having different configurations
|
|
13
|
+
*/
|
|
14
|
+
class TestBucketDeploymentSecurityGroupsMultiple 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 groups with different configurations
|
|
38
|
+
const sg1 = new ec2.SecurityGroup(this, 'SecurityGroup1', {
|
|
39
|
+
vpc,
|
|
40
|
+
description: 'Security group 1 - allow all outbound',
|
|
41
|
+
allowAllOutbound: true,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const sg2 = new ec2.SecurityGroup(this, 'SecurityGroup2', {
|
|
45
|
+
vpc,
|
|
46
|
+
description: 'Security group 2 - restrictive outbound',
|
|
47
|
+
allowAllOutbound: false,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Allow HTTPS outbound for S3 access
|
|
51
|
+
sg2.addEgressRule(
|
|
52
|
+
ec2.Peer.anyIpv4(),
|
|
53
|
+
ec2.Port.tcp(443),
|
|
54
|
+
'Allow HTTPS outbound for S3 access',
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const destinationBucket = new s3.Bucket(this, 'Destination', {
|
|
58
|
+
websiteIndexDocument: 'index.html',
|
|
59
|
+
publicReadAccess: false,
|
|
60
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
61
|
+
autoDeleteObjects: true, // needed for integration test cleanup
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Test deployment with multiple security groups
|
|
65
|
+
new s3deploy.BucketDeployment(this, 'DeployWithMultipleSecurityGroups', {
|
|
66
|
+
sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))],
|
|
67
|
+
destinationBucket,
|
|
68
|
+
destinationKeyPrefix: 'multiple-sg/',
|
|
69
|
+
vpc,
|
|
70
|
+
securityGroups: [sg1, sg2],
|
|
71
|
+
retainOnDelete: false, // default is true, which will block the integration test cleanup
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const app = new cdk.App({
|
|
77
|
+
postCliContext: {
|
|
78
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const testCase = new TestBucketDeploymentSecurityGroupsMultiple(app, 'test-bucket-deployment-security-groups-multiple');
|
|
83
|
+
|
|
84
|
+
new integ.IntegTest(app, 'integ-test-bucket-deployment-security-groups-multiple', {
|
|
85
|
+
testCases: [testCase],
|
|
86
|
+
diffAssets: false,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
app.synth();
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/// !cdk-integ * pragma:enable-lookups
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
4
|
+
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
5
|
+
import * as cdk from 'aws-cdk-lib';
|
|
6
|
+
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
7
|
+
import { Construct } from 'constructs';
|
|
8
|
+
import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Integration test for bucket deployment with single security group:
|
|
12
|
+
* - Lambda function runs in VPC with a single custom security group
|
|
13
|
+
* - Tests that explicit security group assignment works correctly
|
|
14
|
+
*/
|
|
15
|
+
class TestBucketDeploymentSecurityGroupSingle extends cdk.Stack {
|
|
16
|
+
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
|
|
17
|
+
super(scope, id, {
|
|
18
|
+
...props,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Create a VPC inline
|
|
22
|
+
// Use isolated subnets with S3 VPC endpoint - no NAT Gateway or Elastic IP needed
|
|
23
|
+
const vpc = new ec2.Vpc(this, 'TestVpc', {
|
|
24
|
+
restrictDefaultSecurityGroup: false,
|
|
25
|
+
natGateways: 0,
|
|
26
|
+
subnetConfiguration: [
|
|
27
|
+
{
|
|
28
|
+
cidrMask: 24,
|
|
29
|
+
name: 'Isolated',
|
|
30
|
+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Add S3 Gateway endpoint so Lambda can access S3 without NAT Gateway
|
|
36
|
+
vpc.addGatewayEndpoint('S3Endpoint', {
|
|
37
|
+
service: ec2.GatewayVpcEndpointAwsService.S3,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Create security group with explicit outbound rules for S3 access
|
|
41
|
+
const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup1', {
|
|
42
|
+
vpc,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const destinationBucket = new s3.Bucket(this, 'Destination', {
|
|
46
|
+
websiteIndexDocument: 'index.html',
|
|
47
|
+
publicReadAccess: false,
|
|
48
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
49
|
+
autoDeleteObjects: true,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Test deployment with single security group
|
|
53
|
+
new s3deploy.BucketDeployment(this, 'DeployWithSingleSecurityGroup', {
|
|
54
|
+
sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))],
|
|
55
|
+
destinationBucket,
|
|
56
|
+
destinationKeyPrefix: 'single-sg/',
|
|
57
|
+
vpc: vpc,
|
|
58
|
+
securityGroups: [securityGroup],
|
|
59
|
+
retainOnDelete: false,
|
|
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 TestBucketDeploymentSecurityGroupSingle(app, 'test-bucket-deployment-security-groups-single');
|
|
71
|
+
|
|
72
|
+
new integ.IntegTest(app, 'integ-test-bucket-deployment-security-groups-single', {
|
|
73
|
+
testCases: [testCase],
|
|
74
|
+
diffAssets: false,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
app.synth();
|
|
@@ -6,6 +6,12 @@ import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
|
|
|
6
6
|
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
7
7
|
import { Construct } from 'constructs';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Integration test for bucket deployment with content signing:
|
|
11
|
+
* - Lambda function signs PutObject payloads before uploading to S3
|
|
12
|
+
* - Tests signContent flag by enforcing signed payloads via bucket policy
|
|
13
|
+
* - Successful deployment proves that payloads were properly signed
|
|
14
|
+
*/
|
|
9
15
|
class TestBucketDeployment extends cdk.Stack {
|
|
10
16
|
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
|
|
11
17
|
super(scope, id, props);
|
|
@@ -15,17 +21,15 @@ class TestBucketDeployment extends cdk.Stack {
|
|
|
15
21
|
autoDeleteObjects: true, // needed for integration test cleanup
|
|
16
22
|
});
|
|
17
23
|
|
|
18
|
-
const deployment = new s3deploy.BucketDeployment(this, '
|
|
24
|
+
const deployment = new s3deploy.BucketDeployment(this, 'DeployWithSignedContent', {
|
|
19
25
|
sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))],
|
|
20
26
|
destinationBucket: bucket,
|
|
21
27
|
signContent: true,
|
|
22
|
-
retainOnDelete: false,
|
|
28
|
+
retainOnDelete: false,
|
|
23
29
|
});
|
|
24
30
|
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
// PutObject payload signing is not mandatory unless enforced via custom resource policy.
|
|
28
|
-
// With this as a dependency, successful deployment proves that the payloads were signed.
|
|
31
|
+
// PutObject payload signing is not mandatory unless enforced via bucket policy.
|
|
32
|
+
// With this policy dependency, successful deployment proves that the payloads were signed.
|
|
29
33
|
const policyResult = bucket.addToResourcePolicy(
|
|
30
34
|
new iam.PolicyStatement({
|
|
31
35
|
effect: iam.Effect.DENY,
|
|
@@ -53,7 +57,7 @@ const app = new cdk.App({
|
|
|
53
57
|
});
|
|
54
58
|
const testCase = new TestBucketDeployment(app, 'test-bucket-deployment-signobject');
|
|
55
59
|
|
|
56
|
-
new integ.IntegTest(app, 'integ-test-bucket-
|
|
60
|
+
new integ.IntegTest(app, 'integ-test-bucket-deployment-signcontent', {
|
|
57
61
|
testCases: [testCase],
|
|
58
62
|
diffAssets: true,
|
|
59
63
|
});
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
3
3
|
import * as cdk from 'aws-cdk-lib';
|
|
4
|
-
import
|
|
4
|
+
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
5
|
+
import { ExpectedResult } from '@aws-cdk/integ-tests-alpha';
|
|
5
6
|
import { Bucket } from 'aws-cdk-lib/aws-s3';
|
|
6
7
|
import { DeployTimeSubstitutedFile } from 'aws-cdk-lib/aws-s3-deployment';
|
|
8
|
+
import { Construct } from 'constructs';
|
|
7
9
|
import { STANDARD_NODEJS_RUNTIME } from '../../config';
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Integration test for DeployTimeSubstitutedFile with custom destination key:
|
|
13
|
+
* - Tests that custom destinationKey can be specified for the deployed file
|
|
14
|
+
* - Validates that substitution works correctly with custom destination keys
|
|
15
|
+
*/
|
|
16
|
+
class TestBucketDeploymentSubstitutionWithDestinationKey extends cdk.Stack {
|
|
10
17
|
public readonly bucketName: String;
|
|
11
18
|
public readonly objectKey: String;
|
|
12
19
|
public readonly lambdaArn: String;
|
|
13
20
|
|
|
14
|
-
constructor(scope:
|
|
15
|
-
super(scope, id);
|
|
21
|
+
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
|
|
22
|
+
super(scope, id, props);
|
|
16
23
|
|
|
17
24
|
const hello = new lambda.Function(this, 'Hello', {
|
|
18
25
|
runtime: STANDARD_NODEJS_RUNTIME,
|
|
@@ -21,7 +28,7 @@ class Test extends cdk.Stack {
|
|
|
21
28
|
});
|
|
22
29
|
|
|
23
30
|
const bucket = new Bucket(this, 'substitution-bucket');
|
|
24
|
-
const file = new DeployTimeSubstitutedFile(this, '
|
|
31
|
+
const file = new DeployTimeSubstitutedFile(this, 'DeployWithDestinationKey', {
|
|
25
32
|
source: path.join(__dirname, 'sample-file.yaml'),
|
|
26
33
|
destinationBucket: bucket,
|
|
27
34
|
substitutions: {
|
|
@@ -43,12 +50,12 @@ const app = new cdk.App({
|
|
|
43
50
|
},
|
|
44
51
|
});
|
|
45
52
|
|
|
46
|
-
const testCase = new
|
|
47
|
-
const
|
|
53
|
+
const testCase = new TestBucketDeploymentSubstitutionWithDestinationKey(app, 'test-bucket-deployment-substitution-with-destination-key');
|
|
54
|
+
const integTest = new integ.IntegTest(app, 'integ-test-bucket-deployment-substitution-with-destination-key', {
|
|
48
55
|
testCases: [testCase],
|
|
49
56
|
});
|
|
50
57
|
|
|
51
|
-
const apiCall =
|
|
58
|
+
const apiCall = integTest.assertions.awsApiCall('S3', 'getObject', {
|
|
52
59
|
Bucket: testCase.bucketName,
|
|
53
60
|
Key: 'processed-sample-file.yaml',
|
|
54
61
|
});
|
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
3
3
|
import * as cdk from 'aws-cdk-lib';
|
|
4
|
-
import
|
|
4
|
+
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
5
5
|
import { Bucket } from 'aws-cdk-lib/aws-s3';
|
|
6
6
|
import { DeployTimeSubstitutedFile } from 'aws-cdk-lib/aws-s3-deployment';
|
|
7
|
+
import { Construct } from 'constructs';
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Integration test for DeployTimeSubstitutedFile with custom execution role:
|
|
11
|
+
* - Tests that custom IAM roles can be used for the Lambda execution function
|
|
12
|
+
* - Validates that role configuration works correctly with file substitution
|
|
13
|
+
*/
|
|
8
14
|
const app = new cdk.App({
|
|
9
15
|
postCliContext: {
|
|
10
16
|
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
11
17
|
},
|
|
12
18
|
});
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
class TestBucketDeploymentSubstitutionWithRole extends cdk.Stack {
|
|
21
|
+
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
|
|
22
|
+
super(scope, id, props);
|
|
15
23
|
|
|
16
|
-
const bucket = new Bucket(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
24
|
+
const bucket = new Bucket(this, 'Bucket', {
|
|
25
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
26
|
+
autoDeleteObjects: true,
|
|
27
|
+
});
|
|
28
|
+
const executionRole = new iam.Role(this, 'ExecutionRole', {
|
|
29
|
+
assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
|
|
30
|
+
});
|
|
20
31
|
|
|
21
|
-
new DeployTimeSubstitutedFile(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
32
|
+
new DeployTimeSubstitutedFile(this, 'DeployWithCustomRole', {
|
|
33
|
+
source: path.join(__dirname, 'sample-file.yaml'),
|
|
34
|
+
destinationBucket: bucket,
|
|
35
|
+
substitutions: { },
|
|
36
|
+
role: executionRole,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const testCase = new TestBucketDeploymentSubstitutionWithRole(app, 'test-bucket-deployment-substitution-with-role');
|
|
27
42
|
|
|
28
|
-
new IntegTest(app, 'test-
|
|
29
|
-
testCases: [
|
|
43
|
+
new integ.IntegTest(app, 'integ-test-bucket-deployment-substitution-with-role', {
|
|
44
|
+
testCases: [testCase],
|
|
30
45
|
});
|
|
31
46
|
|
|
32
47
|
app.synth();
|