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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
|
|
2
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
3
|
+
import { FunctionUrlOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
4
|
+
import { App, Stack } from 'aws-cdk-lib';
|
|
5
|
+
import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
6
|
+
import { OriginIpAddressType } from 'aws-cdk-lib/aws-cloudfront';
|
|
7
|
+
|
|
8
|
+
const app = new App();
|
|
9
|
+
const stack = new Stack(app, 'FunctionUrlOriginIpAddressTypeStack');
|
|
10
|
+
|
|
11
|
+
// Lambda function
|
|
12
|
+
const fn = new lambda.Function(stack, 'TestFunction', {
|
|
13
|
+
code: lambda.Code.fromInline('exports.handler = async () => ({ statusCode: 200, body: "Hello" });'),
|
|
14
|
+
handler: 'index.handler',
|
|
15
|
+
runtime: lambda.Runtime.NODEJS_20_X,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// Function URL with IAM auth
|
|
19
|
+
const fnUrl = fn.addFunctionUrl({
|
|
20
|
+
authType: lambda.FunctionUrlAuthType.AWS_IAM,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// CloudFront distribution with IPv4 IP address type
|
|
24
|
+
new cloudfront.Distribution(stack, 'DistributionWithoutIpAddressTypeProp(IPv4)', {
|
|
25
|
+
defaultBehavior: {
|
|
26
|
+
origin: FunctionUrlOrigin.withOriginAccessControl(fnUrl, {}),
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// CloudFront distribution with IPv4 IP address type
|
|
31
|
+
const distributionIPv4 = new cloudfront.Distribution(stack, 'DistributionWithIPv4', {
|
|
32
|
+
defaultBehavior: {
|
|
33
|
+
origin: FunctionUrlOrigin.withOriginAccessControl(fnUrl, {
|
|
34
|
+
ipAddressType: OriginIpAddressType.IPV4,
|
|
35
|
+
}),
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// CloudFront distribution with IPv6 IP address type
|
|
40
|
+
const distributionIPv6 = new cloudfront.Distribution(stack, 'DistributionWithIPv6', {
|
|
41
|
+
defaultBehavior: {
|
|
42
|
+
origin: FunctionUrlOrigin.withOriginAccessControl(fnUrl, {
|
|
43
|
+
ipAddressType: OriginIpAddressType.IPV6,
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// CloudFront distribution with dualstack IP address type
|
|
49
|
+
const distributionDualstack = new cloudfront.Distribution(stack, 'DistributionWithDualstack', {
|
|
50
|
+
defaultBehavior: {
|
|
51
|
+
origin: FunctionUrlOrigin.withOriginAccessControl(fnUrl, {
|
|
52
|
+
ipAddressType: OriginIpAddressType.DUALSTACK,
|
|
53
|
+
}),
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const integ = new IntegTest(app, 'FunctionUrlOriginIpAddressTypeTest', {
|
|
58
|
+
testCases: [stack],
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Assert that distributions are created with expected IP address type settings
|
|
62
|
+
integ.assertions.awsApiCall('CloudFront', 'getDistribution', {
|
|
63
|
+
Id: distributionIPv4.distributionId,
|
|
64
|
+
}).assertAtPath('Distribution.DistributionConfig.IsIPV4Enabled', ExpectedResult.exact(true));
|
|
65
|
+
|
|
66
|
+
integ.assertions.awsApiCall('CloudFront', 'getDistribution', {
|
|
67
|
+
Id: distributionIPv4.distributionId,
|
|
68
|
+
}).assertAtPath('Distribution.DistributionConfig.IsIPV6Enabled', ExpectedResult.exact(false));
|
|
69
|
+
|
|
70
|
+
integ.assertions.awsApiCall('CloudFront', 'getDistribution', {
|
|
71
|
+
Id: distributionIPv6.distributionId,
|
|
72
|
+
}).assertAtPath('Distribution.DistributionConfig.IsIPV4Enabled', ExpectedResult.exact(false));
|
|
73
|
+
|
|
74
|
+
integ.assertions.awsApiCall('CloudFront', 'getDistribution', {
|
|
75
|
+
Id: distributionIPv6.distributionId,
|
|
76
|
+
}).assertAtPath('Distribution.DistributionConfig.IsIPV6Enabled', ExpectedResult.exact(true));
|
|
77
|
+
|
|
78
|
+
integ.assertions.awsApiCall('CloudFront', 'getDistribution', {
|
|
79
|
+
Id: distributionDualstack.distributionId,
|
|
80
|
+
}).assertAtPath('Distribution.DistributionConfig.IsIPV4Enabled', ExpectedResult.exact(true));
|
|
81
|
+
|
|
82
|
+
integ.assertions.awsApiCall('CloudFront', 'getDistribution', {
|
|
83
|
+
Id: distributionDualstack.distributionId,
|
|
84
|
+
}).assertAtPath('Distribution.DistributionConfig.IsIPV6Enabled', ExpectedResult.exact(true));
|
|
@@ -13,7 +13,7 @@ const httpOrigin = new origins.HttpOrigin('example.com', {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
const fn = new lambda.Function(stack, 'Function', {
|
|
16
|
-
runtime: lambda.Runtime.
|
|
16
|
+
runtime: lambda.Runtime.NODEJS_20_X,
|
|
17
17
|
handler: 'index.handler',
|
|
18
18
|
code: lambda.Code.fromInline('exports.handler = async () => ({ statusCode: 200, body: "Hello from Lambda!" });'),
|
|
19
19
|
});
|
|
@@ -13,7 +13,7 @@ const stack = new cdk.Stack(app, 'integ-cloudtrail-data-events');
|
|
|
13
13
|
|
|
14
14
|
const bucket = new s3.Bucket(stack, 'Bucket', { removalPolicy: cdk.RemovalPolicy.DESTROY });
|
|
15
15
|
const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', {
|
|
16
|
-
runtime: lambda.Runtime.
|
|
16
|
+
runtime: lambda.Runtime.NODEJS_20_X,
|
|
17
17
|
handler: 'hello.handler',
|
|
18
18
|
code: lambda.Code.fromInline('exports.handler = {}'),
|
|
19
19
|
});
|
|
@@ -479,7 +479,7 @@ const metric = new cloudwatch.Metric({
|
|
|
479
479
|
namespace: 'AWS/EC2',
|
|
480
480
|
metricName: 'CPUUtilization',
|
|
481
481
|
statistic: 'Average',
|
|
482
|
-
period: Duration.
|
|
482
|
+
period: Duration.hours(1), // Alarm will use the metric's period
|
|
483
483
|
});
|
|
484
484
|
|
|
485
485
|
// Create an anomaly detection alarm
|
|
@@ -5,12 +5,19 @@ import { Metric, ComparisonOperator, AnomalyDetectionAlarm, Alarm } from 'aws-cd
|
|
|
5
5
|
const app = new App();
|
|
6
6
|
const stack = new Stack(app, 'AnomalyDetectionAlarmTestStack');
|
|
7
7
|
|
|
8
|
-
// Create the test metric
|
|
8
|
+
// Create the test metric. Period will default to 300 seconds.
|
|
9
9
|
const metric = new Metric({
|
|
10
10
|
namespace: 'AWS/EC2',
|
|
11
11
|
metricName: 'CPUUtilization',
|
|
12
12
|
statistic: 'Average',
|
|
13
|
-
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// Create test metric with custom period
|
|
16
|
+
const customPeriodMetric = new Metric({
|
|
17
|
+
namespace: 'AWS/EC2',
|
|
18
|
+
metricName: 'CPUUtilization',
|
|
19
|
+
statistic: 'Average',
|
|
20
|
+
period: Duration.days(1),
|
|
14
21
|
});
|
|
15
22
|
|
|
16
23
|
// Create an anomaly detection alarm with default operator
|
|
@@ -40,6 +47,14 @@ const descriptiveAlarm = Metric.anomalyDetectionFor({
|
|
|
40
47
|
comparisonOperator: ComparisonOperator.GREATER_THAN_UPPER_THRESHOLD,
|
|
41
48
|
});
|
|
42
49
|
|
|
50
|
+
// Create an anomaly detection alarm with custom period
|
|
51
|
+
const customPeriodAlarm = new AnomalyDetectionAlarm(stack, 'CustomPeriodAnomalyAlarm', {
|
|
52
|
+
metric: customPeriodMetric,
|
|
53
|
+
stdDevs: 2,
|
|
54
|
+
evaluationPeriods: 1,
|
|
55
|
+
comparisonOperator: ComparisonOperator.LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD,
|
|
56
|
+
});
|
|
57
|
+
|
|
43
58
|
// Create the integration test
|
|
44
59
|
const integ = new IntegTest(app, 'AnomalyDetectionAlarmIntegTest', {
|
|
45
60
|
testCases: [stack],
|
|
@@ -122,3 +137,30 @@ integ.assertions
|
|
|
122
137
|
}),
|
|
123
138
|
]),
|
|
124
139
|
}));
|
|
140
|
+
|
|
141
|
+
integ.assertions
|
|
142
|
+
.awsApiCall('CloudWatch', 'describeAlarms', {
|
|
143
|
+
AlarmNames: [customPeriodAlarm.alarmName],
|
|
144
|
+
})
|
|
145
|
+
.expect(ExpectedResult.objectLike({
|
|
146
|
+
MetricAlarms: Match.arrayWith([
|
|
147
|
+
Match.objectLike({
|
|
148
|
+
ComparisonOperator: 'LessThanLowerOrGreaterThanUpperThreshold',
|
|
149
|
+
EvaluationPeriods: 1,
|
|
150
|
+
ThresholdMetricId: 'expr_1',
|
|
151
|
+
Metrics: Match.arrayWith([
|
|
152
|
+
Match.objectLike({
|
|
153
|
+
Expression: 'ANOMALY_DETECTION_BAND(m0, 2)',
|
|
154
|
+
Id: 'expr_1',
|
|
155
|
+
ReturnData: true,
|
|
156
|
+
}),
|
|
157
|
+
Match.objectLike({
|
|
158
|
+
Id: 'm0',
|
|
159
|
+
MetricStat: Match.objectLike({
|
|
160
|
+
Period: 86400, // 1 day in seconds, orignal metric period got overriden
|
|
161
|
+
}),
|
|
162
|
+
}),
|
|
163
|
+
]),
|
|
164
|
+
}),
|
|
165
|
+
]),
|
|
166
|
+
}));
|
|
@@ -5,7 +5,7 @@ import * as iam from 'aws-cdk-lib/aws-iam';
|
|
|
5
5
|
import { IManagedPolicy, ManagedPolicyReference } from 'aws-cdk-lib/aws-iam';
|
|
6
6
|
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
7
7
|
import * as deploy from 'aws-cdk-lib/aws-s3-deployment';
|
|
8
|
-
import { App, Fn, RemovalPolicy, Stack, UnscopedValidationError } from 'aws-cdk-lib';
|
|
8
|
+
import { App, Fn, RemovalPolicy, ResourceEnvironment, Stack, UnscopedValidationError } from 'aws-cdk-lib';
|
|
9
9
|
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
10
10
|
import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions';
|
|
11
11
|
import { Node } from 'constructs';
|
|
@@ -56,6 +56,9 @@ function makePolicy(arn: string): IManagedPolicy {
|
|
|
56
56
|
get node(): Node {
|
|
57
57
|
throw new UnscopedValidationError('The result of fromAwsManagedPolicyName can not be used in this API');
|
|
58
58
|
},
|
|
59
|
+
get env(): ResourceEnvironment {
|
|
60
|
+
throw new UnscopedValidationError('The result of fromAwsManagedPolicyName can not be used in this API');
|
|
61
|
+
},
|
|
59
62
|
};
|
|
60
63
|
}
|
|
61
64
|
|
|
@@ -480,13 +480,13 @@ new cognito.UserPool(this, 'myuserpool', {
|
|
|
480
480
|
|
|
481
481
|
### Threat Protection
|
|
482
482
|
|
|
483
|
-
This feature is only available if your Feature Plan is set to PLUS.
|
|
484
|
-
|
|
485
483
|
Threat Protection can be set to configure enforcement levels and automatic responses for users in password-based and custom-challenge authentication flows.
|
|
486
484
|
For configuration, there are 2 options for standard authentication and custom authentication.
|
|
487
485
|
These are represented with properties `standardThreatProtectionMode` and `customThreatProtectionMode`.
|
|
488
486
|
See the [documentation on Threat Protection](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-threat-protection.html)
|
|
489
487
|
|
|
488
|
+
**Note**: Threat Protection requires the PLUS feature plan for new user pools. CDK allows you to configure threat protection settings at synthesis time, and CloudFormation will validate feature plan requirements at deployment time. Existing user pools that are grandfathered on LITE plans with threat protection enabled will continue to work.
|
|
489
|
+
|
|
490
490
|
|
|
491
491
|
### Emails
|
|
492
492
|
|
|
@@ -381,7 +381,7 @@ https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-mgmt
|
|
|
381
381
|
|
|
382
382
|
Secondary indexes allow efficient access to data with attributes other than the `primaryKey`. DynamoDB supports two types of secondary indexes:
|
|
383
383
|
|
|
384
|
-
* Global secondary index - An index with
|
|
384
|
+
* Global secondary index - An index with partition key(s) and optional sort key(s) that can be different from those on the base table. A `globalSecondaryIndex` is considered "global" because queries on the index can span all of the data in the base table, across all partitions. A `globalSecondaryIndex` is stored in its own partition space away from the base table and scales separately from the base table.
|
|
385
385
|
|
|
386
386
|
* Local secondary index - An index that has the same `partitionKey` as the base table, but a different `sortKey`. A `localSecondaryIndex` is "local" in the sense that every partition of a `localSecondaryIndex` is scoped to a base table partition that has the same `partitionKey` value.
|
|
387
387
|
|
|
@@ -404,7 +404,41 @@ const table = new dynamodb.TableV2(this, 'Table', {
|
|
|
404
404
|
});
|
|
405
405
|
```
|
|
406
406
|
|
|
407
|
-
|
|
407
|
+
#### Compound Keys
|
|
408
|
+
|
|
409
|
+
Global secondary indexes support compound keys, allowing you to specify multiple partition keys and/or multiple sort keys. This enables more flexible query patterns for complex data models.
|
|
410
|
+
|
|
411
|
+
**Key Constraints:**
|
|
412
|
+
- You can specify up to **4 partition keys** per global secondary index
|
|
413
|
+
- You can specify up to **4 sort keys** per global secondary index
|
|
414
|
+
- Use **either** `partitionKey` (singular) **or** `partitionKeys` (plural), but not both
|
|
415
|
+
- Use **either** `sortKey` (singular) **or** `sortKeys` (plural), but not both
|
|
416
|
+
- At least one partition key must be specified (either `partitionKey` or `partitionKeys`)
|
|
417
|
+
- For multiple keys, you **must** use the plural parameters (`partitionKeys` and/or `sortKeys`)
|
|
418
|
+
- **Keys cannot be added or modified after index creation** - attempting to add additional keys to an existing index will result in an error
|
|
419
|
+
|
|
420
|
+
**Example with compound partition and sort keys:**
|
|
421
|
+
|
|
422
|
+
```ts
|
|
423
|
+
const table = new dynamodb.TableV2(this, 'Table', {
|
|
424
|
+
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
425
|
+
globalSecondaryIndexes: [
|
|
426
|
+
{
|
|
427
|
+
indexName: 'compound-gsi',
|
|
428
|
+
partitionKeys: [
|
|
429
|
+
{ name: 'gsi_pk1', type: dynamodb.AttributeType.STRING },
|
|
430
|
+
{ name: 'gsi_pk2', type: dynamodb.AttributeType.NUMBER },
|
|
431
|
+
],
|
|
432
|
+
sortKeys: [
|
|
433
|
+
{ name: 'gsi_sk1', type: dynamodb.AttributeType.STRING },
|
|
434
|
+
{ name: 'gsi_sk2', type: dynamodb.AttributeType.BINARY },
|
|
435
|
+
],
|
|
436
|
+
},
|
|
437
|
+
],
|
|
438
|
+
});
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
You can also add a `globalSecondaryIndex` using the `addGlobalSecondaryIndex` method:
|
|
408
442
|
|
|
409
443
|
```ts
|
|
410
444
|
const table = new dynamodb.TableV2(this, 'Table', {
|
|
@@ -421,6 +455,16 @@ table.addGlobalSecondaryIndex({
|
|
|
421
455
|
indexName: 'gsi2',
|
|
422
456
|
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
423
457
|
});
|
|
458
|
+
|
|
459
|
+
// Add a GSI with compound keys
|
|
460
|
+
table.addGlobalSecondaryIndex({
|
|
461
|
+
indexName: 'compound-gsi2',
|
|
462
|
+
partitionKeys: [
|
|
463
|
+
{ name: 'compound_pk1', type: dynamodb.AttributeType.STRING },
|
|
464
|
+
{ name: 'compound_pk2', type: dynamodb.AttributeType.NUMBER },
|
|
465
|
+
],
|
|
466
|
+
sortKey: { name: 'sk', type: dynamodb.AttributeType.STRING },
|
|
467
|
+
});
|
|
424
468
|
```
|
|
425
469
|
|
|
426
470
|
You can configure `readCapacity` and `writeCapacity` on a `globalSecondaryIndex` when an `TableV2` is configured with provisioned `billing`. If `TableV2` is configured with provisioned `billing` but `readCapacity` or `writeCapacity` are not configured on a `globalSecondaryIndex`, then they will be inherited from the capacity settings specified with the `billing` configuration:
|
|
@@ -816,9 +860,88 @@ Using `resourcePolicy` you can add a [resource policy](https://docs.aws.amazon.c
|
|
|
816
860
|
});
|
|
817
861
|
```
|
|
818
862
|
|
|
863
|
+
### Adding Resource Policy Statements Dynamically
|
|
864
|
+
|
|
865
|
+
You can also add resource policy statements to a table after it's created using the `addToResourcePolicy` method. Following the same pattern as KMS, resource policies use wildcard resources to avoid circular dependencies:
|
|
866
|
+
|
|
867
|
+
```ts
|
|
868
|
+
const table = new dynamodb.TableV2(this, 'Table', {
|
|
869
|
+
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
870
|
+
});
|
|
871
|
+
|
|
872
|
+
// Standard resource policy (recommended approach)
|
|
873
|
+
table.addToResourcePolicy(new iam.PolicyStatement({
|
|
874
|
+
actions: ['dynamodb:GetItem', 'dynamodb:PutItem', 'dynamodb:Query'],
|
|
875
|
+
principals: [new iam.AccountRootPrincipal()],
|
|
876
|
+
resources: ['*'], // Wildcard avoids circular dependency - same pattern as KMS
|
|
877
|
+
}));
|
|
878
|
+
|
|
879
|
+
// Allow specific service access
|
|
880
|
+
table.addToResourcePolicy(new iam.PolicyStatement({
|
|
881
|
+
actions: ['dynamodb:Query'],
|
|
882
|
+
principals: [new iam.ServicePrincipal('lambda.amazonaws.com')],
|
|
883
|
+
resources: ['*'],
|
|
884
|
+
}));
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
#### Scoped Resource Policies (Advanced)
|
|
888
|
+
|
|
889
|
+
For scoped resource policies that reference specific table ARNs, you must specify an explicit table name:
|
|
890
|
+
|
|
891
|
+
```ts
|
|
892
|
+
import { Fn } from 'aws-cdk-lib';
|
|
893
|
+
|
|
894
|
+
// Table with explicit name enables scoped resource policies
|
|
895
|
+
const table = new dynamodb.TableV2(this, 'Table', {
|
|
896
|
+
tableName: 'my-explicit-table-name', // Required for scoped resources
|
|
897
|
+
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
898
|
+
});
|
|
899
|
+
|
|
900
|
+
// Now you can use scoped resources
|
|
901
|
+
table.addToResourcePolicy(new iam.PolicyStatement({
|
|
902
|
+
actions: ['dynamodb:GetItem'],
|
|
903
|
+
principals: [new iam.AccountRootPrincipal()],
|
|
904
|
+
resources: [
|
|
905
|
+
Fn.sub('arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/my-explicit-table-name'),
|
|
906
|
+
Fn.sub('arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/my-explicit-table-name/index/*'),
|
|
907
|
+
],
|
|
908
|
+
}));
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
**Important Limitations:**
|
|
912
|
+
- **Auto-generated table names**: Must use `resources: ['*']` to avoid circular dependencies
|
|
913
|
+
- **Explicit table names**: Enable scoped resources but lose CDK's automatic naming benefits
|
|
914
|
+
- **CloudFormation constraint**: Resource policies cannot reference the resource they're attached to during creation
|
|
915
|
+
|
|
819
916
|
TableV2 doesn’t support creating a replica and adding a resource-based policy to that replica in the same stack update in Regions other than the Region where you deploy the stack update.
|
|
820
917
|
To incorporate a resource-based policy into a replica, you'll need to initially deploy the replica without the policy, followed by a subsequent update to include the desired policy.
|
|
821
918
|
|
|
919
|
+
### Grant Methods and Resource Policies
|
|
920
|
+
|
|
921
|
+
Grant methods like `grantReadData()`, `grantWriteData()`, and `grantReadWriteData()` automatically add permissions to resource policies when used with same-account principals (like `AccountRootPrincipal`). This happens transparently:
|
|
922
|
+
|
|
923
|
+
```ts
|
|
924
|
+
const table = new dynamodb.TableV2(this, 'Table', {
|
|
925
|
+
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
// Automatically adds to table's resource policy (same account)
|
|
929
|
+
table.grantReadData(new iam.AccountRootPrincipal());
|
|
930
|
+
|
|
931
|
+
// Adds to IAM user's policy (not resource policy)
|
|
932
|
+
declare const user: iam.User;
|
|
933
|
+
table.grantReadData(user);
|
|
934
|
+
```
|
|
935
|
+
|
|
936
|
+
**How it works:**
|
|
937
|
+
- **Same-account principals** (AccountRootPrincipal, AccountPrincipal): Grant adds statement to table's resource policy
|
|
938
|
+
- **IAM identities** (User, Role, Group): Grant adds statement to the identity's IAM policy
|
|
939
|
+
- **Resource policy statements**: Automatically use wildcard resources (`*`) to avoid circular dependencies
|
|
940
|
+
|
|
941
|
+
This behavior follows the same pattern as other AWS services like KMS and S3, where grants intelligently choose between resource policies and identity policies based on the principal type.
|
|
942
|
+
|
|
943
|
+
**To avoid wildcards in resource policies:** If you need scoped resource ARNs instead of wildcards, use `addToResourcePolicy()` directly with an explicit table name instead of grant methods. See the "Scoped Resource Policies (Advanced)" section above for details.
|
|
944
|
+
|
|
822
945
|
## Grants
|
|
823
946
|
|
|
824
947
|
Using any of the `grant*` methods on an instance of the `TableV2` construct will only apply to the primary table, its indexes, and any associated `encryptionKey`. As an example, `grantReadData` used below will only apply the table in `us-west-2`:
|
|
@@ -210,12 +210,55 @@ To get the partition key and sort key of the table or indexes you have configure
|
|
|
210
210
|
|
|
211
211
|
```ts
|
|
212
212
|
declare const table: dynamodb.Table;
|
|
213
|
+
|
|
214
|
+
// For single keys, use schema() (deprecated for compound keys)
|
|
213
215
|
const schema = table.schema();
|
|
214
216
|
const partitionKey = schema.partitionKey;
|
|
215
217
|
const sortKey = schema.sortKey;
|
|
216
218
|
|
|
217
|
-
//
|
|
218
|
-
|
|
219
|
+
// For compound keys, use schemaV2() which returns normalized arrays
|
|
220
|
+
const schemaV2 = table.schemaV2();
|
|
221
|
+
const partitionKeys = schemaV2.partitionKeys; // Attribute[]
|
|
222
|
+
const sortKeys = schemaV2.sortKeys; // Attribute[]
|
|
223
|
+
|
|
224
|
+
// Get schema for a specific index
|
|
225
|
+
const indexSchema = table.schemaV2('INDEX_NAME');
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Note: `schema()` is deprecated for indexes with compound keys and will throw an error. Use `schemaV2()` instead, which always returns normalized arrays.
|
|
229
|
+
|
|
230
|
+
## Global Secondary Indexes with Compound Keys
|
|
231
|
+
|
|
232
|
+
Global secondary indexes support compound keys, allowing you to specify multiple partition keys and/or multiple sort keys. This enables more flexible query patterns for complex data models.
|
|
233
|
+
|
|
234
|
+
**Key Constraints:**
|
|
235
|
+
- You can specify up to **4 partition keys** per global secondary index
|
|
236
|
+
- You can specify up to **4 sort keys** per global secondary index
|
|
237
|
+
- Use **either** `partitionKey` (singular) **or** `partitionKeys` (plural), but not both
|
|
238
|
+
- Use **either** `sortKey` (singular) **or** `sortKeys` (plural), but not both
|
|
239
|
+
- At least one partition key must be specified (either `partitionKey` or `partitionKeys`)
|
|
240
|
+
- For multiple keys, you **must** use the plural parameters (`partitionKeys` and/or `sortKeys`)
|
|
241
|
+
- **Keys cannot be added or modified after index creation** - attempting to add additional keys to an existing index will result in an error
|
|
242
|
+
|
|
243
|
+
**Example:**
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
const table = new dynamodb.Table(this, 'Table', {
|
|
247
|
+
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
248
|
+
sortKey: { name: 'sk', type: dynamodb.AttributeType.STRING },
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
table.addGlobalSecondaryIndex({
|
|
252
|
+
indexName: 'compound-gsi',
|
|
253
|
+
partitionKeys: [
|
|
254
|
+
{ name: 'gsi_pk1', type: dynamodb.AttributeType.STRING },
|
|
255
|
+
{ name: 'gsi_pk2', type: dynamodb.AttributeType.NUMBER },
|
|
256
|
+
],
|
|
257
|
+
sortKeys: [
|
|
258
|
+
{ name: 'gsi_sk1', type: dynamodb.AttributeType.STRING },
|
|
259
|
+
{ name: 'gsi_sk2', type: dynamodb.AttributeType.BINARY },
|
|
260
|
+
],
|
|
261
|
+
});
|
|
219
262
|
```
|
|
220
263
|
|
|
221
264
|
## Kinesis Stream
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration test for DynamoDB Table.addToResourcePolicy() method
|
|
3
|
+
*
|
|
4
|
+
* This test validates the fix for issue #35062: "(aws-dynamodb): `addToResourcePolicy` has no effect"
|
|
5
|
+
*
|
|
6
|
+
* WHAT WE'RE TESTING:
|
|
7
|
+
* - The addToResourcePolicy() method was broken - it had "no effect" when called
|
|
8
|
+
* - Resource policies weren't being added to the CloudFormation template
|
|
9
|
+
* - This created a security gap where developers thought they were securing tables but policies weren't applied
|
|
10
|
+
*
|
|
11
|
+
* TEST VALIDATION:
|
|
12
|
+
* 1. Creates DynamoDB tables with different resource policy configurations
|
|
13
|
+
* 2. Tests both wildcard resources (for auto-generated names) and scoped resources (for explicit names)
|
|
14
|
+
* 3. Verifies policies get added to CloudFormation templates with correct structure
|
|
15
|
+
* 4. Ensures both patterns work without circular dependencies
|
|
16
|
+
*
|
|
17
|
+
* @see https://github.com/aws/aws-cdk/issues/35062
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { App, Fn, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib';
|
|
21
|
+
import { Construct } from 'constructs';
|
|
22
|
+
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
|
|
23
|
+
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
24
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
25
|
+
|
|
26
|
+
export class TestStack extends Stack {
|
|
27
|
+
public readonly wildcardTable: dynamodb.Table;
|
|
28
|
+
public readonly scopedTable: dynamodb.Table;
|
|
29
|
+
public readonly grantTable: dynamodb.Table;
|
|
30
|
+
|
|
31
|
+
constructor(scope: Construct, id: string, props?: StackProps) {
|
|
32
|
+
super(scope, id, props);
|
|
33
|
+
|
|
34
|
+
// TEST 1: Table with wildcard resource policy (auto-generated name)
|
|
35
|
+
// This is the standard pattern to avoid circular dependencies
|
|
36
|
+
this.wildcardTable = new dynamodb.Table(this, 'WildcardTable', {
|
|
37
|
+
partitionKey: {
|
|
38
|
+
name: 'id',
|
|
39
|
+
type: dynamodb.AttributeType.STRING,
|
|
40
|
+
},
|
|
41
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Add resource policy with wildcard resources
|
|
45
|
+
this.wildcardTable.addToResourcePolicy(new iam.PolicyStatement({
|
|
46
|
+
actions: ['dynamodb:GetItem', 'dynamodb:PutItem', 'dynamodb:Query'],
|
|
47
|
+
principals: [new iam.AccountRootPrincipal()],
|
|
48
|
+
resources: ['*'], // Use wildcard to avoid circular dependency - standard pattern for resource policies
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
// TEST 2: Table with scoped resource policy (explicit table name)
|
|
52
|
+
// This demonstrates how to use scoped resources when table name is known at synthesis time
|
|
53
|
+
this.scopedTable = new dynamodb.Table(this, 'ScopedTable', {
|
|
54
|
+
tableName: 'my-explicit-scoped-table', // Explicit name enables scoped ARN construction
|
|
55
|
+
partitionKey: {
|
|
56
|
+
name: 'id',
|
|
57
|
+
type: dynamodb.AttributeType.STRING,
|
|
58
|
+
},
|
|
59
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Add resource policy with properly scoped resource using explicit table name
|
|
63
|
+
// This works because table name is known at synthesis time (no circular dependency)
|
|
64
|
+
this.scopedTable.addToResourcePolicy(new iam.PolicyStatement({
|
|
65
|
+
actions: ['dynamodb:GetItem', 'dynamodb:Query'],
|
|
66
|
+
principals: [new iam.AccountRootPrincipal()],
|
|
67
|
+
// Use CloudFormation intrinsic function to construct table ARN with known table name
|
|
68
|
+
resources: [Fn.sub('arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/my-explicit-scoped-table')],
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
// TEST 3: Table using grant methods with AccountRootPrincipal
|
|
72
|
+
// This validates the fix for issue #35967: circular dependency when using grant methods
|
|
73
|
+
// Before fix: grant methods with AccountRootPrincipal caused circular dependency
|
|
74
|
+
// After fix: grant methods use resourceSelfArns: ['*'] to avoid circular dependency
|
|
75
|
+
this.grantTable = new dynamodb.Table(this, 'GrantTable', {
|
|
76
|
+
partitionKey: {
|
|
77
|
+
name: 'id',
|
|
78
|
+
type: dynamodb.AttributeType.STRING,
|
|
79
|
+
},
|
|
80
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// This should NOT cause circular dependency - validates fix for #35967
|
|
84
|
+
// Using grantWriteData because it has simpler actions valid for resource policies
|
|
85
|
+
this.grantTable.grantWriteData(new iam.AccountRootPrincipal());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Test Setup
|
|
90
|
+
const app = new App();
|
|
91
|
+
const stack = new TestStack(app, 'add-to-resource-policy-test-stack');
|
|
92
|
+
|
|
93
|
+
// Integration Test Configuration
|
|
94
|
+
new IntegTest(app, 'add-to-resource-policy-integ-test', {
|
|
95
|
+
testCases: [stack],
|
|
96
|
+
});
|
|
97
|
+
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.compound.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { App, RemovalPolicy, Stack } from 'aws-cdk-lib';
|
|
2
|
+
import { AttributeType, ProjectionType, Table } from 'aws-cdk-lib/aws-dynamodb';
|
|
3
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
4
|
+
|
|
5
|
+
const app = new App();
|
|
6
|
+
const stack = new Stack(app, 'aws-cdk-dynamodb-compound-keys');
|
|
7
|
+
|
|
8
|
+
const table = new Table(stack, 'Table', {
|
|
9
|
+
tableName: 'cdk-test-compound',
|
|
10
|
+
partitionKey: { name: 'pkey', type: AttributeType.NUMBER },
|
|
11
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
table.addGlobalSecondaryIndex({
|
|
15
|
+
indexName: 'IndexA',
|
|
16
|
+
partitionKeys: [{ name: 'PK1', type: AttributeType.STRING }, { name: 'PK2', type: AttributeType.NUMBER }],
|
|
17
|
+
sortKeys: [{ name: 'SK1', type: AttributeType.STRING }, { name: 'SK2', type: AttributeType.NUMBER }],
|
|
18
|
+
projectionType: ProjectionType.INCLUDE,
|
|
19
|
+
nonKeyAttributes: ['bar'],
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
table.addGlobalSecondaryIndex({
|
|
23
|
+
indexName: 'IndexB',
|
|
24
|
+
partitionKey: { name: 'baz', type: AttributeType.STRING },
|
|
25
|
+
sortKeys: [{ name: 'bar', type: AttributeType.STRING }, { name: 'foo', type: AttributeType.NUMBER }],
|
|
26
|
+
projectionType: ProjectionType.INCLUDE,
|
|
27
|
+
nonKeyAttributes: ['blah'],
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
new IntegTest(app, 'aws-cdk-dynamodb-compound-key-gsi', {
|
|
31
|
+
testCases: [stack],
|
|
32
|
+
});
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.policy.ts
CHANGED
|
@@ -38,7 +38,27 @@ export class TestStack extends Stack {
|
|
|
38
38
|
removalPolicy: RemovalPolicy.DESTROY,
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
// IMPORTANT: Cross-account grants with auto-generated table names create circular dependencies
|
|
42
|
+
//
|
|
43
|
+
// WHY NOT this.tableTwo.grantReadData(new iam.AccountPrincipal('123456789012'))?
|
|
44
|
+
// - Cross-account principals cannot have policies attached to them
|
|
45
|
+
// - Grant falls back to adding a resource policy to the table
|
|
46
|
+
// - Resource policy tries to reference this.tableArn (the table's own ARN)
|
|
47
|
+
// - This creates a circular dependency: Table → ResourcePolicy → Table ARN → Table
|
|
48
|
+
// - CloudFormation fails with "Circular dependency between resources"
|
|
49
|
+
//
|
|
50
|
+
// SOLUTIONS:
|
|
51
|
+
// 1. Use addToResourcePolicy with wildcard resources (this approach)
|
|
52
|
+
// 2. Use explicit table names: tableName: 'my-table-name' (enables scoped resources)
|
|
53
|
+
// 3. Use same-account principals (grants go to principal policy, not resource policy)
|
|
54
|
+
//
|
|
55
|
+
this.tableTwo.addToResourcePolicy(new iam.PolicyStatement({
|
|
56
|
+
actions: ['dynamodb:*'],
|
|
57
|
+
// we need a valid account for cross-account principal otherwise it won't deploy
|
|
58
|
+
// this account is from fact-table.ts
|
|
59
|
+
principals: [new iam.AccountPrincipal('127311923021')],
|
|
60
|
+
resources: ['*'], // Wildcard avoids circular dependency - same pattern as KMS
|
|
61
|
+
}));
|
|
42
62
|
}
|
|
43
63
|
}
|
|
44
64
|
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.table-v2.compound.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
2
|
+
import { App, RemovalPolicy, Stack } from 'aws-cdk-lib';
|
|
3
|
+
import { AttributeType, ProjectionType, TableV2 } from 'aws-cdk-lib/aws-dynamodb';
|
|
4
|
+
|
|
5
|
+
const app = new App();
|
|
6
|
+
const stack = new Stack(app, 'aws-cdk-dynamodb-v2-compound-keys');
|
|
7
|
+
|
|
8
|
+
const table = new TableV2(stack, 'Table', {
|
|
9
|
+
tableName: 'cdk-test-tableV2-compound',
|
|
10
|
+
partitionKey: { name: 'pkey', type: AttributeType.NUMBER },
|
|
11
|
+
globalSecondaryIndexes: [{
|
|
12
|
+
indexName: 'IndexA',
|
|
13
|
+
partitionKeys: [{ name: 'GSIAPK1', type: AttributeType.STRING }, { name: 'GSIAPK2', type: AttributeType.STRING }],
|
|
14
|
+
sortKeys: [{ name: 'GSIASK1', type: AttributeType.STRING }, { name: 'GSIASK2', type: AttributeType.NUMBER }],
|
|
15
|
+
}],
|
|
16
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
table.addGlobalSecondaryIndex({
|
|
20
|
+
indexName: 'IndexB',
|
|
21
|
+
partitionKeys: [{ name: 'PK1', type: AttributeType.STRING }, { name: 'PK2', type: AttributeType.NUMBER }],
|
|
22
|
+
sortKeys: [{ name: 'SK1', type: AttributeType.STRING }, { name: 'SK2', type: AttributeType.NUMBER }],
|
|
23
|
+
projectionType: ProjectionType.INCLUDE,
|
|
24
|
+
nonKeyAttributes: ['bar'],
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
table.addGlobalSecondaryIndex({
|
|
28
|
+
indexName: 'IndexC',
|
|
29
|
+
partitionKey: { name: 'baz', type: AttributeType.STRING },
|
|
30
|
+
sortKeys: [{ name: 'bar', type: AttributeType.STRING }],
|
|
31
|
+
projectionType: ProjectionType.INCLUDE,
|
|
32
|
+
nonKeyAttributes: ['blah'],
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
table.addGlobalSecondaryIndex({
|
|
36
|
+
indexName: 'IndexD',
|
|
37
|
+
partitionKeys: [{ name: 'PK3', type: AttributeType.STRING }, { name: 'PK4', type: AttributeType.NUMBER }],
|
|
38
|
+
sortKeys: [{ name: 'SK3', type: AttributeType.STRING }, { name: 'SK4', type: AttributeType.NUMBER }],
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
new IntegTest(app, 'aws-cdk-dynamodbv2-compound-key-gsi', {
|
|
42
|
+
testCases: [stack],
|
|
43
|
+
});
|