konokenj.cdk-api-mcp-server 0.48.0__py3-none-any.whl → 0.57.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.
- cdk_api_mcp_server/__about__.py +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-amplify-alpha/README.md +12 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-bedrock-agentcore-alpha/README.md +1979 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-bedrock-alpha/README.md +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-eks-v2-alpha/README.md +156 -69
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-imagebuilder-alpha/README.md +656 -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-msk-alpha/README.md +38 -8
- 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 +182 -0
- 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 +34 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/integ.api-with-authorizer-and-proxy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/integ.lambda-api.ts +1 -1
- 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-apigateway/integ.spec-restapi.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/README.md +93 -81
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.stage.ts +20 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-authorizers/integ.iam.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-authorizers/integ.lambda.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-authorizers/integ.user-pool.ts +1 -1
- 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.add-subroute-integration.ts +7 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.http-proxy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.lambda-connect-disconnect-trigger.ts +2 -2
- 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-apigatewayv2-integrations/integ.lambda-proxy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.lambda.ts +4 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-appsync/integ.graphql-lambda-permission.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-appsync/integ.js-resolver.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-batch/README.md +15 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-batch/integ.managed-compute-environment-default-instance-class.ts +20 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudformation/integ.core-custom-resources-node-18.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudformation/integ.core-custom-resources-service-timeout.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/README.md +33 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/integ.function-url-origin-ip-address-type.ts +84 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/integ.origin-response-completion-timeout.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudtrail/integ.cloudtrail-data-events-only.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/README.md +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/integ.anomaly-detection-alarm.ts +44 -2
- 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-codepipeline-actions/integ.pipeline-elastic-beanstalk-deploy.ts +4 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cognito/README.md +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/README.md +125 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/TABLE_V1_API.md +45 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.add-to-resource-policy.ts +97 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.compound.ts +32 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.policy.ts +21 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.table-v2.compound.ts +43 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/README.md +16 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/integ.client-vpn-endpoint-disconnect-on-session-timeout.ts +65 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/integ.vpc-flow-logs.ts +4 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr/README.md +41 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr/integ.tag-mutability-exclusion.ts +30 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/README.md +47 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.managedinstances-capacity-provider.ts +5 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.managedinstances-no-default-capacity-provider.ts +107 -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-ecs-patterns/integ.alb-fargate-service-public-private-switch.ts +45 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/README.md +103 -83
- 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.eks-cluster-removal-policy.ts +31 -0
- 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-elasticloadbalancingv2/README.md +34 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.alb-lambda-multi-value-headers.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.alb.oidc.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.nlb.security-group.ts +70 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2-actions/integ.cognito.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events-targets/README.md +22 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events-targets/integ.firehose-delivery-stream.ts +51 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-iam/integ.managed-policy.ts +9 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-iam/integ.policy.ts +9 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesis/README.md +42 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesis/integ.stream-shard-level-monitoring.ts +47 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/README.md +156 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.cloudwatch-logs-processors.ts +45 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.record-format-conversion-schema.ts +154 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.record-format-conversion.ts +178 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/README.md +39 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.binary-payload.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.logging-config.ts +8 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.multi-tenancy.ts +24 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.params-and-secrets.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime-management.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime.fromasset.ts +19 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime.inlinecode.ts +11 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/integ.dependencies-pnpm.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/integ.function-exclude-smithy-models.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/integ.nodejs.build.images.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/README.md +4 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/integ.metricfilter-apply-on-transformed-logs.ts +29 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/integ.subscriptionfilter.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-opensearchservice/integ.opensearch.ebs.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-opensearchservice/integ.opensearch.min.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/README.md +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster-cloudwatch-logs-exports.ts +56 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster-data-api-to-imported-cluster.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster-data-api.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/README.md +44 -31
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/integ.private-hosted-zone-from-attributes.ts +41 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/integ.zone-delegation-iam-stack.ts +66 -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 +17 -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 +99 -59
- 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 +23 -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 +15 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.call-aws-service-cross-region-lambda.ts +1 -1
- 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/aws-stepfunctions-tasks/integ.invoke-json-path.ts +102 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/README.md +17 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary-runtime-validation.ts +43 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary.ts +2 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/README.md +56 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.aws-custom-resource.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.custom-resource-config-lambda-node-runtime.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.external-id.ts +80 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.invoke-function-payload.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +71 -10
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/README.md +32 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/interfaces/README.md +33 -0
- {konokenj_cdk_api_mcp_server-0.48.0.dist-info → konokenj_cdk_api_mcp_server-0.57.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.48.0.dist-info → konokenj_cdk_api_mcp_server-0.57.0.dist-info}/RECORD +151 -106
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events-targets/integ.kinesis-firehose-stream.ts +0 -33
- {konokenj_cdk_api_mcp_server-0.48.0.dist-info → konokenj_cdk_api_mcp_server-0.57.0.dist-info}/WHEEL +0 -0
- {konokenj_cdk_api_mcp_server-0.48.0.dist-info → konokenj_cdk_api_mcp_server-0.57.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.48.0.dist-info → konokenj_cdk_api_mcp_server-0.57.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -1,76 +1,105 @@
|
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
21
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
24
|
+
this.bucket = new Bucket(this, 'Bucket', {
|
|
25
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
26
|
+
autoDeleteObjects: true,
|
|
27
|
+
});
|
|
40
28
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
//
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
// Store secret in SSM (workaround for #21503)
|
|
47
|
+
const param = new ssm.StringParameter(this, 'SecretParam', {
|
|
48
|
+
stringValue: secret.secretValueFromJson('value').unsafeUnwrap(),
|
|
49
|
+
});
|
|
50
|
+
|
|
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
|
+
});
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
// Test empty string handling
|
|
65
|
+
const file8 = Source.data('file8.txt', '');
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
// Test null JSON data value
|
|
68
|
+
const file9 = Source.jsonData('my-json/config-with-null.json', { hello: 'there', goodbye: null });
|
|
69
|
+
|
|
70
|
+
const deployment = new BucketDeployment(this, 'DeployWithDataSources', {
|
|
71
|
+
destinationBucket: this.bucket,
|
|
72
|
+
sources: [file1, file2],
|
|
73
|
+
destinationKeyPrefix: 'deploy/here/',
|
|
74
|
+
retainOnDelete: false,
|
|
75
|
+
});
|
|
76
|
+
// Test addSource() method
|
|
77
|
+
deployment.addSource(file3);
|
|
78
|
+
deployment.addSource(file4);
|
|
79
|
+
deployment.addSource(file5);
|
|
80
|
+
deployment.addSource(file6);
|
|
81
|
+
deployment.addSource(file7);
|
|
82
|
+
deployment.addSource(file8);
|
|
83
|
+
deployment.addSource(file9);
|
|
84
|
+
|
|
85
|
+
new CfnOutput(this, 'BucketName', { value: this.bucket.bucketName });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const app = new App({
|
|
90
|
+
postCliContext: {
|
|
91
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
92
|
+
},
|
|
69
93
|
});
|
|
94
|
+
const testCase = new TestBucketDeploymentData(app, 'test-bucket-deployment-data');
|
|
70
95
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
96
|
+
const integTest = new IntegTest(app, 'integ-test-bucket-deployment-data', {
|
|
97
|
+
testCases: [testCase],
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Assert that addSource() successfully adds the data source alongside the asset source
|
|
101
|
+
const assertionProvider = integTest.assertions.awsApiCall('S3', 'getObject', {
|
|
102
|
+
Bucket: testCase.bucket.bucketName,
|
|
74
103
|
Key: path.join('deploy/here', 'my-json/secret-config.json'),
|
|
75
104
|
});
|
|
76
105
|
|
|
@@ -80,9 +109,20 @@ assertionProvider.expect(ExpectedResult.objectLike({
|
|
|
80
109
|
Body: '{"secret_value":"test\\"with\\"quotes"}',
|
|
81
110
|
}));
|
|
82
111
|
|
|
112
|
+
// Assert that JSON data with a null value is represented properly
|
|
113
|
+
const jsonNullAssertionProvider = integTest.assertions.awsApiCall('S3', 'getObject', {
|
|
114
|
+
Bucket: testCase.bucket.bucketName,
|
|
115
|
+
Key: path.join('deploy/here', 'my-json/config-with-null.json'),
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Verify the content is valid JSON and both null and non-null fields are present
|
|
119
|
+
jsonNullAssertionProvider.expect(ExpectedResult.objectLike({
|
|
120
|
+
Body: '{"hello":"there","goodbye":null}',
|
|
121
|
+
}));
|
|
122
|
+
|
|
83
123
|
// Add assertions to verify the YAML file
|
|
84
|
-
const yamlAssertionProvider =
|
|
85
|
-
Bucket: bucket.bucketName,
|
|
124
|
+
const yamlAssertionProvider = integTest.assertions.awsApiCall('S3', 'getObject', {
|
|
125
|
+
Bucket: testCase.bucket.bucketName,
|
|
86
126
|
Key: path.join('deploy/here', 'my-yaml/secret-config.yaml'),
|
|
87
127
|
});
|
|
88
128
|
|
|
@@ -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,19 +10,29 @@ 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
|
|
25
32
|
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cdk-large-files-'));
|
|
33
|
+
process.on('exit', () => {
|
|
34
|
+
fs.rmSync(tempDir, { force: true, recursive: true });
|
|
35
|
+
});
|
|
26
36
|
|
|
27
37
|
// Generate a large JSON file (10MB) programmatically
|
|
28
38
|
const largeJsonFilePath = path.join(tempDir, 'large-file.json');
|
|
@@ -153,7 +163,7 @@ const noEscapeFileWithMarker = Source.jsonData('my-json/secret-config-no-escape.
|
|
|
153
163
|
});
|
|
154
164
|
|
|
155
165
|
// Deploy the large files
|
|
156
|
-
new BucketDeployment(stack, '
|
|
166
|
+
new BucketDeployment(stack, 'DeployWithLargeFiles', {
|
|
157
167
|
destinationBucket: bucket,
|
|
158
168
|
sources: [largeJsonSource, largeTextSource, fileWithMarker, noEscapeFileWithMarker],
|
|
159
169
|
retainOnDelete: false,
|
|
@@ -161,12 +171,12 @@ new BucketDeployment(stack, 'DeployLargeFiles', {
|
|
|
161
171
|
|
|
162
172
|
new CfnOutput(stack, 'BucketName', { value: bucket.bucketName });
|
|
163
173
|
|
|
164
|
-
const
|
|
174
|
+
const integTest = new IntegTest(app, 'integ-test-bucket-deployment-large-file', {
|
|
165
175
|
testCases: [stack],
|
|
166
176
|
});
|
|
167
177
|
|
|
168
|
-
//
|
|
169
|
-
const assertionProvider =
|
|
178
|
+
// Assert that escaped JSON is properly escaped
|
|
179
|
+
const assertionProvider = integTest.assertions.awsApiCall('S3', 'getObject', {
|
|
170
180
|
Bucket: bucket.bucketName,
|
|
171
181
|
Key: 'my-json/secret-config.json',
|
|
172
182
|
});
|
|
@@ -177,7 +187,8 @@ assertionProvider.expect(ExpectedResult.objectLike({
|
|
|
177
187
|
Body: '{"secret_value":"test\\"with\\"quotes"}',
|
|
178
188
|
}));
|
|
179
189
|
|
|
180
|
-
|
|
190
|
+
// Assert that unescaped JSON works without escape option
|
|
191
|
+
integTest.assertions.awsApiCall('S3', 'getObject', {
|
|
181
192
|
Bucket: bucket.bucketName,
|
|
182
193
|
Key: 'my-json/secret-config-no-escape.json',
|
|
183
194
|
}).expect(ExpectedResult.objectLike({
|
|
@@ -185,8 +196,8 @@ integ.assertions.awsApiCall('S3', 'getObject', {
|
|
|
185
196
|
Body: '{"secret_value":"test"with"quotes"}',
|
|
186
197
|
}));
|
|
187
198
|
|
|
188
|
-
//
|
|
189
|
-
const jsonAssertionProvider =
|
|
199
|
+
// Assert that large JSON file was deployed successfully
|
|
200
|
+
const jsonAssertionProvider = integTest.assertions.awsApiCall('S3', 'listObjectsV2', {
|
|
190
201
|
Bucket: bucket.bucketName,
|
|
191
202
|
Prefix: 'large-file.json',
|
|
192
203
|
MaxKeys: 1,
|
|
@@ -211,8 +222,8 @@ if (jsonAssertionProvider instanceof AwsApiCall && jsonAssertionProvider.waiterP
|
|
|
211
222
|
});
|
|
212
223
|
}
|
|
213
224
|
|
|
214
|
-
//
|
|
215
|
-
const textAssertionProvider =
|
|
225
|
+
// Assert that large text file was deployed successfully
|
|
226
|
+
const textAssertionProvider = integTest.assertions.awsApiCall('S3', 'listObjectsV2', {
|
|
216
227
|
Bucket: bucket.bucketName,
|
|
217
228
|
Prefix: 'large-file.txt',
|
|
218
229
|
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();
|