konokenj.cdk-api-mcp-server 0.52.0__py3-none-any.whl → 0.54.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-eks-v2-alpha/README.md +45 -45
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-imagebuilder-alpha/README.md +94 -0
- 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/aws-sagemaker-alpha/README.md +32 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/mixins-preview/README.md +151 -5
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/README.md/README.md +2 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/README.md +25 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/integ.lambda-permission-consolidation.ts +55 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/README.md +35 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.lambda-permission-consolidation.ts +45 -0
- 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-dynamodb/README.md +26 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.add-to-resource-policy.ts +17 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.placement-strategies.ts +32 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/README.md +86 -86
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/integ.eks-al2023-nodegroup.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/integ.fargate-cluster.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime.inlinecode.ts +7 -0
- 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-secretsmanager/integ.secret.dynamic-reference-key.ts +38 -0
- 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/aws-stepfunctions-tasks/README.md +14 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.evaluate-expression-arm64.ts +27 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.evaluate-expression-default.ts +25 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.evaluate-expression-mixed-arch.ts +35 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.evaluate-expression-x86.ts +27 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/interfaces/README.md +33 -0
- {konokenj_cdk_api_mcp_server-0.52.0.dist-info → konokenj_cdk_api_mcp_server-0.54.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.52.0.dist-info → konokenj_cdk_api_mcp_server-0.54.0.dist-info}/RECORD +58 -38
- {konokenj_cdk_api_mcp_server-0.52.0.dist-info → konokenj_cdk_api_mcp_server-0.54.0.dist-info}/WHEEL +0 -0
- {konokenj_cdk_api_mcp_server-0.52.0.dist-info → konokenj_cdk_api_mcp_server-0.54.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.52.0.dist-info → konokenj_cdk_api_mcp_server-0.54.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -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();
|
|
@@ -1,18 +1,26 @@
|
|
|
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:
|
|
13
|
+
* - Tests deploy-time string substitution in template files
|
|
14
|
+
* - Validates that token values (like Lambda ARN) are properly substituted
|
|
15
|
+
* - Tests both token and static string substitutions
|
|
16
|
+
*/
|
|
17
|
+
class TestBucketDeploymentSubstitution extends cdk.Stack {
|
|
10
18
|
public readonly bucketName: String;
|
|
11
19
|
public readonly objectKey: String;
|
|
12
20
|
public readonly lambdaArn: String;
|
|
13
21
|
|
|
14
|
-
constructor(scope:
|
|
15
|
-
super(scope, id);
|
|
22
|
+
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
|
|
23
|
+
super(scope, id, props);
|
|
16
24
|
|
|
17
25
|
const hello = new lambda.Function(this, 'Hello', {
|
|
18
26
|
runtime: STANDARD_NODEJS_RUNTIME,
|
|
@@ -21,7 +29,7 @@ class Test extends cdk.Stack {
|
|
|
21
29
|
});
|
|
22
30
|
|
|
23
31
|
const bucket = new Bucket(this, 'substitution-bucket');
|
|
24
|
-
const file = new DeployTimeSubstitutedFile(this, '
|
|
32
|
+
const file = new DeployTimeSubstitutedFile(this, 'DeployWithSubstitution', {
|
|
25
33
|
source: path.join(__dirname, 'sample-file.yaml'),
|
|
26
34
|
destinationBucket: bucket,
|
|
27
35
|
substitutions: {
|
|
@@ -42,12 +50,12 @@ const app = new cdk.App({
|
|
|
42
50
|
},
|
|
43
51
|
});
|
|
44
52
|
|
|
45
|
-
const testCase = new
|
|
46
|
-
const
|
|
53
|
+
const testCase = new TestBucketDeploymentSubstitution(app, 'test-bucket-deployment-substitution');
|
|
54
|
+
const integTest = new integ.IntegTest(app, 'integ-test-bucket-deployment-substitution', {
|
|
47
55
|
testCases: [testCase],
|
|
48
56
|
});
|
|
49
57
|
|
|
50
|
-
const apiCall =
|
|
58
|
+
const apiCall = integTest.assertions.awsApiCall('S3', 'getObject', {
|
|
51
59
|
Bucket: testCase.bucketName,
|
|
52
60
|
Key: testCase.objectKey,
|
|
53
61
|
});
|
|
@@ -0,0 +1,65 @@
|
|
|
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 basic VPC configuration:
|
|
11
|
+
* - Lambda function runs in VPC with isolated subnets
|
|
12
|
+
* - Uses S3 Gateway endpoint to access S3 without NAT Gateway
|
|
13
|
+
*/
|
|
14
|
+
class TestBucketDeploymentVpcBasic extends cdk.Stack {
|
|
15
|
+
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
|
|
16
|
+
super(scope, id, props);
|
|
17
|
+
|
|
18
|
+
// Basic VPC with isolated subnets - no NAT Gateway or Elastic IP needed
|
|
19
|
+
// Add S3 VPC Gateway endpoint for Lambda to access S3 without internet
|
|
20
|
+
const vpc = new ec2.Vpc(this, 'BasicVpc', {
|
|
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 bucket = new s3.Bucket(this, 'Destination', {
|
|
38
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
39
|
+
autoDeleteObjects: true,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
new s3deploy.BucketDeployment(this, 'DeployWithBasicVpc', {
|
|
43
|
+
sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))],
|
|
44
|
+
destinationBucket: bucket,
|
|
45
|
+
destinationKeyPrefix: 'basic-vpc/',
|
|
46
|
+
vpc: vpc,
|
|
47
|
+
retainOnDelete: false,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const app = new cdk.App({
|
|
53
|
+
postCliContext: {
|
|
54
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const testCase = new TestBucketDeploymentVpcBasic(app, 'test-bucket-deployment-vpc-basic');
|
|
59
|
+
|
|
60
|
+
new integ.IntegTest(app, 'integ-test-bucket-deployment-vpc-basic', {
|
|
61
|
+
testCases: [testCase],
|
|
62
|
+
diffAssets: false,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
app.synth();
|
|
@@ -0,0 +1,66 @@
|
|
|
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 VPC and Lambda configuration:
|
|
11
|
+
* - Lambda function runs in VPC with custom memory limit
|
|
12
|
+
* - Tests that Lambda configuration options work with VPC deployments
|
|
13
|
+
*/
|
|
14
|
+
class TestBucketDeploymentVpcConfig extends cdk.Stack {
|
|
15
|
+
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
|
|
16
|
+
super(scope, id, props);
|
|
17
|
+
|
|
18
|
+
// VPC with memory and timeout configuration
|
|
19
|
+
// Use isolated subnets with S3 VPC endpoint - no NAT Gateway or Elastic IP needed
|
|
20
|
+
const vpc = new ec2.Vpc(this, 'ConfigVpc', {
|
|
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 bucket = new s3.Bucket(this, 'Destination', {
|
|
38
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
39
|
+
autoDeleteObjects: true,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
new s3deploy.BucketDeployment(this, 'DeployWithVpcAndConfig', {
|
|
43
|
+
sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))],
|
|
44
|
+
destinationBucket: bucket,
|
|
45
|
+
destinationKeyPrefix: 'config-vpc/',
|
|
46
|
+
vpc: vpc,
|
|
47
|
+
memoryLimit: 1024,
|
|
48
|
+
retainOnDelete: false,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const app = new cdk.App({
|
|
54
|
+
postCliContext: {
|
|
55
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const testCase = new TestBucketDeploymentVpcConfig(app, 'test-bucket-deployment-vpc-config');
|
|
60
|
+
|
|
61
|
+
new integ.IntegTest(app, 'integ-test-bucket-deployment-vpc-config', {
|
|
62
|
+
testCases: [testCase],
|
|
63
|
+
diffAssets: false,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
app.synth();
|
|
@@ -0,0 +1,66 @@
|
|
|
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 VPC and custom subnet configuration:
|
|
11
|
+
* - Lambda function runs in VPC with custom maxAzs and subnet configuration
|
|
12
|
+
* - Tests that custom VPC configurations work with bucket deployments
|
|
13
|
+
*/
|
|
14
|
+
class TestBucketDeploymentVpcCustomSubnets extends cdk.Stack {
|
|
15
|
+
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
|
|
16
|
+
super(scope, id, props);
|
|
17
|
+
|
|
18
|
+
// VPC with custom subnet configuration
|
|
19
|
+
// Use isolated subnets with S3 VPC endpoint - no NAT Gateway or Elastic IP needed
|
|
20
|
+
const vpc = new ec2.Vpc(this, 'CustomVpc', {
|
|
21
|
+
restrictDefaultSecurityGroup: false,
|
|
22
|
+
maxAzs: 2,
|
|
23
|
+
natGateways: 0,
|
|
24
|
+
subnetConfiguration: [
|
|
25
|
+
{
|
|
26
|
+
cidrMask: 24,
|
|
27
|
+
name: 'Isolated',
|
|
28
|
+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Add S3 Gateway endpoint so Lambda can access S3 without NAT Gateway
|
|
34
|
+
vpc.addGatewayEndpoint('S3Endpoint', {
|
|
35
|
+
service: ec2.GatewayVpcEndpointAwsService.S3,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const bucket = new s3.Bucket(this, 'Destination', {
|
|
39
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
40
|
+
autoDeleteObjects: true,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
new s3deploy.BucketDeployment(this, 'DeployWithCustomVpc', {
|
|
44
|
+
sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))],
|
|
45
|
+
destinationBucket: bucket,
|
|
46
|
+
destinationKeyPrefix: 'custom-vpc/',
|
|
47
|
+
vpc: vpc,
|
|
48
|
+
retainOnDelete: false,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const app = new cdk.App({
|
|
54
|
+
postCliContext: {
|
|
55
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const testCase = new TestBucketDeploymentVpcCustomSubnets(app, 'test-bucket-deployment-vpc-custom-subnets');
|
|
60
|
+
|
|
61
|
+
new integ.IntegTest(app, 'integ-test-bucket-deployment-vpc-custom-subnets', {
|
|
62
|
+
testCases: [testCase],
|
|
63
|
+
diffAssets: false,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
app.synth();
|