diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/aws-cdk-global-table-v2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/aws-cdk-global-table-v2.assets.json new file mode 100644 index 0000000000000..a07133b76fc7d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/aws-cdk-global-table-v2.assets.json @@ -0,0 +1,20 @@ +{ + "version": "36.0.0", + "files": { + "f6c3259c52a142bbcf580bb47c14037f7819c4cebfb51d6c8586c38bc79c5509": { + "source": { + "path": "aws-cdk-global-table-v2.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-eu-west-1": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1", + "objectKey": "f6c3259c52a142bbcf580bb47c14037f7819c4cebfb51d6c8586c38bc79c5509.json", + "region": "eu-west-1", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-eu-west-1" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/aws-cdk-global-table-v2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/aws-cdk-global-table-v2.template.json new file mode 100644 index 0000000000000..35b13b4c70e59 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/aws-cdk-global-table-v2.template.json @@ -0,0 +1,117 @@ +{ + "Resources": { + "GlobalTableV212B4E024": { + "Type": "AWS::DynamoDB::GlobalTable", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "pk", + "AttributeType": "S" + }, + { + "AttributeName": "sk", + "AttributeType": "N" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "GlobalSecondaryIndexes": [ + { + "IndexName": "gsi2", + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + } + ], + "Projection": { + "ProjectionType": "ALL" + }, + "WriteOnDemandThroughputSettings": { + "MaxWriteRequestUnits": 2001 + } + } + ], + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "sk", + "KeyType": "RANGE" + } + ], + "Replicas": [ + { + "GlobalSecondaryIndexes": [ + { + "IndexName": "gsi2", + "ReadOnDemandThroughputSettings": { + "MaxReadRequestUnits": 2001 + } + } + ], + "ReadOnDemandThroughputSettings": { + "MaxReadRequestUnits": 222 + }, + "Region": "us-east-1" + }, + { + "GlobalSecondaryIndexes": [ + { + "IndexName": "gsi2", + "ReadOnDemandThroughputSettings": { + "MaxReadRequestUnits": 2001 + } + } + ], + "Region": "eu-west-1" + } + ], + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + }, + "TableName": "my-global-table-v2", + "WriteOnDemandThroughputSettings": { + "MaxWriteRequestUnits": 10 + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.assets.json new file mode 100644 index 0000000000000..02772f0375026 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/integ.json new file mode 100644 index 0000000000000..d1446d6169277 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/integ.json @@ -0,0 +1,16 @@ +{ + "version": "36.0.0", + "testCases": { + "aws-cdk-global-table-integ-v2/DefaultTest": { + "stacks": [ + "aws-cdk-global-table-v2" + ], + "regions": [ + "eu-west-1" + ], + "stackUpdateWorkflow": false, + "assertionStack": "aws-cdk-global-table-integ-v2/DefaultTest/DeployAssert", + "assertionStackName": "awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/manifest.json new file mode 100644 index 0000000000000..0377675ebe18a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/manifest.json @@ -0,0 +1,121 @@ +{ + "version": "36.0.0", + "artifacts": { + "aws-cdk-global-table-v2.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-global-table-v2.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-global-table-v2": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/eu-west-1", + "properties": { + "templateFile": "aws-cdk-global-table-v2.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-eu-west-1", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-eu-west-1", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-eu-west-1/f6c3259c52a142bbcf580bb47c14037f7819c4cebfb51d6c8586c38bc79c5509.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-global-table-v2.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-eu-west-1", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-cdk-global-table-v2.assets" + ], + "metadata": { + "/aws-cdk-global-table-v2/GlobalTableV2": [ + { + "type": "aws:cdk:hasPhysicalName", + "data": { + "Ref": "GlobalTableV212B4E024" + } + } + ], + "/aws-cdk-global-table-v2/GlobalTableV2/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "GlobalTableV212B4E024" + } + ], + "/aws-cdk-global-table-v2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-global-table-v2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-global-table-v2" + }, + "awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "awscdkglobaltableintegv2DefaultTestDeployAssertF1A4FD2A.assets" + ], + "metadata": { + "/aws-cdk-global-table-integ-v2/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-global-table-integ-v2/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-global-table-integ-v2/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/tree.json new file mode 100644 index 0000000000000..574bf311dffef --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.js.snapshot/tree.json @@ -0,0 +1,196 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-cdk-global-table-v2": { + "id": "aws-cdk-global-table-v2", + "path": "aws-cdk-global-table-v2", + "children": { + "GlobalTableV2": { + "id": "GlobalTableV2", + "path": "aws-cdk-global-table-v2/GlobalTableV2", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-global-table-v2/GlobalTableV2/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::GlobalTable", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "pk", + "attributeType": "S" + }, + { + "attributeName": "sk", + "attributeType": "N" + } + ], + "billingMode": "PAY_PER_REQUEST", + "globalSecondaryIndexes": [ + { + "indexName": "gsi2", + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + } + ], + "projection": { + "projectionType": "ALL" + }, + "writeOnDemandThroughputSettings": { + "maxWriteRequestUnits": 2001 + } + } + ], + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + }, + { + "attributeName": "sk", + "keyType": "RANGE" + } + ], + "replicas": [ + { + "region": "us-east-1", + "globalSecondaryIndexes": [ + { + "indexName": "gsi2", + "readOnDemandThroughputSettings": { + "maxReadRequestUnits": 2001 + } + } + ], + "readOnDemandThroughputSettings": { + "maxReadRequestUnits": 222 + } + }, + { + "region": "eu-west-1", + "globalSecondaryIndexes": [ + { + "indexName": "gsi2", + "readOnDemandThroughputSettings": { + "maxReadRequestUnits": 2001 + } + } + ] + } + ], + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + }, + "tableName": "my-global-table-v2", + "writeOnDemandThroughputSettings": { + "maxWriteRequestUnits": 10 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnGlobalTable", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.TableBaseV2", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-global-table-v2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-global-table-v2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "aws-cdk-global-table-integ-v2": { + "id": "aws-cdk-global-table-integ-v2", + "path": "aws-cdk-global-table-integ-v2", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "aws-cdk-global-table-integ-v2/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "aws-cdk-global-table-integ-v2/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "aws-cdk-global-table-integ-v2/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-global-table-integ-v2/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-global-table-integ-v2/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.ts new file mode 100644 index 0000000000000..794266767b156 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.max-request-units.ts @@ -0,0 +1,41 @@ +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { AttributeType, Billing, TableV2 } from 'aws-cdk-lib/aws-dynamodb'; +import { Construct } from 'constructs'; + +class TestStack extends Stack { + public constructor(scope: Construct, id: string, props: StackProps) { + super(scope, id, props); + + new TableV2(this, 'GlobalTableV2', { + tableName: 'my-global-table-v2', + partitionKey: { name: 'pk', type: AttributeType.STRING }, + sortKey: { name: 'sk', type: AttributeType.NUMBER }, + billing: Billing.onDemand({ + maxWriteRequestUnits: 10, + }), + removalPolicy: RemovalPolicy.DESTROY, + replicas: [ + { + region: 'us-east-1', + maxReadRequestUnits: 222, + }, + ], + globalSecondaryIndexes: [ + { + indexName: 'gsi2', + partitionKey: { name: 'pk', type: AttributeType.STRING }, + maxReadRequestUnits: 2001, + maxWriteRequestUnits: 2001, + }, + ], + }); + } +} + +const app = new App(); +new IntegTest(app, 'aws-cdk-global-table-integ-v2', { + testCases: [new TestStack(app, 'aws-cdk-global-table-v2', { env: { region: 'eu-west-1' } })], + regions: ['eu-west-1'], + stackUpdateWorkflow: false, +}); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/aws-cdk-global-table.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/aws-cdk-global-table.assets.json new file mode 100644 index 0000000000000..aa94a2c7845ca --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/aws-cdk-global-table.assets.json @@ -0,0 +1,20 @@ +{ + "version": "36.0.0", + "files": { + "cc5278f2745ed14e48839e10ba3e84d52a026101a039e164e937d90f16b69c34": { + "source": { + "path": "aws-cdk-global-table.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-us-east-1": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1", + "objectKey": "cc5278f2745ed14e48839e10ba3e84d52a026101a039e164e937d90f16b69c34.json", + "region": "us-east-1", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-us-east-1" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/aws-cdk-global-table.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/aws-cdk-global-table.template.json new file mode 100644 index 0000000000000..e1e71ad2043c7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/aws-cdk-global-table.template.json @@ -0,0 +1,247 @@ +{ + "Resources": { + "Stream790BDEE4": { + "Type": "AWS::Kinesis::Stream", + "Properties": { + "RetentionPeriodHours": 24, + "ShardCount": 1, + "StreamEncryption": { + "Fn::If": [ + "AwsCdkKinesisEncryptedStreamsUnsupportedRegions", + { + "Ref": "AWS::NoValue" + }, + { + "EncryptionType": "KMS", + "KeyId": "alias/aws/kinesis" + } + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "GlobalTable89F068B2": { + "Type": "AWS::DynamoDB::GlobalTable", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "pk", + "AttributeType": "S" + }, + { + "AttributeName": "sk", + "AttributeType": "N" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "GlobalSecondaryIndexes": [ + { + "IndexName": "gsi1", + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + } + ], + "Projection": { + "ProjectionType": "ALL" + } + }, + { + "IndexName": "gsi2", + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + } + ], + "Projection": { + "ProjectionType": "ALL" + }, + "WriteOnDemandThroughputSettings": { + "MaxWriteRequestUnits": 2001 + } + } + ], + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "sk", + "KeyType": "RANGE" + } + ], + "LocalSecondaryIndexes": [ + { + "IndexName": "lsi", + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + }, + { + "AttributeName": "sk", + "KeyType": "RANGE" + } + ], + "Projection": { + "ProjectionType": "ALL" + } + } + ], + "Replicas": [ + { + "ContributorInsightsSpecification": { + "Enabled": true + }, + "GlobalSecondaryIndexes": [ + { + "ContributorInsightsSpecification": { + "Enabled": true + }, + "IndexName": "gsi1", + "ReadOnDemandThroughputSettings": { + "MaxReadRequestUnits": 1002 + } + }, + { + "ContributorInsightsSpecification": { + "Enabled": true + }, + "IndexName": "gsi2", + "ReadOnDemandThroughputSettings": { + "MaxReadRequestUnits": 2001 + } + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "ReadOnDemandThroughputSettings": { + "MaxReadRequestUnits": 222 + }, + "Region": "eu-west-1", + "TableClass": "STANDARD_INFREQUENT_ACCESS" + }, + { + "ContributorInsightsSpecification": { + "Enabled": true + }, + "GlobalSecondaryIndexes": [ + { + "ContributorInsightsSpecification": { + "Enabled": true + }, + "IndexName": "gsi1", + "ReadOnDemandThroughputSettings": { + "MaxReadRequestUnits": 1002 + } + }, + { + "ContributorInsightsSpecification": { + "Enabled": true + }, + "IndexName": "gsi2", + "ReadOnDemandThroughputSettings": { + "MaxReadRequestUnits": 2001 + } + } + ], + "KinesisStreamSpecification": { + "StreamArn": { + "Fn::GetAtt": [ + "Stream790BDEE4", + "Arn" + ] + } + }, + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "Region": "us-east-1", + "TableClass": "STANDARD_INFREQUENT_ACCESS", + "Tags": [ + { + "Key": "primaryTableTagKey", + "Value": "primaryTableTagValue" + } + ] + } + ], + "SSESpecification": { + "SSEEnabled": true, + "SSEType": "KMS" + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + }, + "TableName": "my-global-table", + "TimeToLiveSpecification": { + "AttributeName": "attr", + "Enabled": true + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "Conditions": { + "AwsCdkKinesisEncryptedStreamsUnsupportedRegions": { + "Fn::Or": [ + { + "Fn::Equals": [ + { + "Ref": "AWS::Region" + }, + "cn-north-1" + ] + }, + { + "Fn::Equals": [ + { + "Ref": "AWS::Region" + }, + "cn-northwest-1" + ] + } + ] + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.assets.json new file mode 100644 index 0000000000000..0a9ffc385b09a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/integ.json new file mode 100644 index 0000000000000..15437c63539c9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/integ.json @@ -0,0 +1,16 @@ +{ + "version": "36.0.0", + "testCases": { + "aws-cdk-global-table-integ/DefaultTest": { + "stacks": [ + "aws-cdk-global-table" + ], + "regions": [ + "us-east-1" + ], + "stackUpdateWorkflow": false, + "assertionStack": "aws-cdk-global-table-integ/DefaultTest/DeployAssert", + "assertionStackName": "awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/manifest.json new file mode 100644 index 0000000000000..f36374c4697b1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/manifest.json @@ -0,0 +1,133 @@ +{ + "version": "36.0.0", + "artifacts": { + "aws-cdk-global-table.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-global-table.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-global-table": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/us-east-1", + "properties": { + "templateFile": "aws-cdk-global-table.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-us-east-1", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-us-east-1", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1/cc5278f2745ed14e48839e10ba3e84d52a026101a039e164e937d90f16b69c34.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-global-table.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-us-east-1", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-cdk-global-table.assets" + ], + "metadata": { + "/aws-cdk-global-table/Stream/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Stream790BDEE4" + } + ], + "/aws-cdk-global-table/AwsCdkKinesisEncryptedStreamsUnsupportedRegions": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsCdkKinesisEncryptedStreamsUnsupportedRegions" + } + ], + "/aws-cdk-global-table/GlobalTable": [ + { + "type": "aws:cdk:hasPhysicalName", + "data": { + "Ref": "GlobalTable89F068B2" + } + } + ], + "/aws-cdk-global-table/GlobalTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "GlobalTable89F068B2" + } + ], + "/aws-cdk-global-table/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-global-table/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-global-table" + }, + "awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.assets" + ], + "metadata": { + "/aws-cdk-global-table-integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-global-table-integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-global-table-integ/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/tree.json new file mode 100644 index 0000000000000..963c19fb401dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.js.snapshot/tree.json @@ -0,0 +1,328 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-cdk-global-table": { + "id": "aws-cdk-global-table", + "path": "aws-cdk-global-table", + "children": { + "Stream": { + "id": "Stream", + "path": "aws-cdk-global-table/Stream", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-global-table/Stream/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Kinesis::Stream", + "aws:cdk:cloudformation:props": { + "retentionPeriodHours": 24, + "shardCount": 1, + "streamEncryption": { + "Fn::If": [ + "AwsCdkKinesisEncryptedStreamsUnsupportedRegions", + { + "Ref": "AWS::NoValue" + }, + { + "EncryptionType": "KMS", + "KeyId": "alias/aws/kinesis" + } + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kinesis.CfnStream", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kinesis.Stream", + "version": "0.0.0" + } + }, + "AwsCdkKinesisEncryptedStreamsUnsupportedRegions": { + "id": "AwsCdkKinesisEncryptedStreamsUnsupportedRegions", + "path": "aws-cdk-global-table/AwsCdkKinesisEncryptedStreamsUnsupportedRegions", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnCondition", + "version": "0.0.0" + } + }, + "GlobalTable": { + "id": "GlobalTable", + "path": "aws-cdk-global-table/GlobalTable", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-global-table/GlobalTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::GlobalTable", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "pk", + "attributeType": "S" + }, + { + "attributeName": "sk", + "attributeType": "N" + } + ], + "billingMode": "PAY_PER_REQUEST", + "globalSecondaryIndexes": [ + { + "indexName": "gsi1", + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + } + ], + "projection": { + "projectionType": "ALL" + } + }, + { + "indexName": "gsi2", + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + } + ], + "projection": { + "projectionType": "ALL" + }, + "writeOnDemandThroughputSettings": { + "maxWriteRequestUnits": 2001 + } + } + ], + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + }, + { + "attributeName": "sk", + "keyType": "RANGE" + } + ], + "localSecondaryIndexes": [ + { + "indexName": "lsi", + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + }, + { + "attributeName": "sk", + "keyType": "RANGE" + } + ], + "projection": { + "projectionType": "ALL" + } + } + ], + "replicas": [ + { + "region": "eu-west-1", + "globalSecondaryIndexes": [ + { + "indexName": "gsi1", + "readOnDemandThroughputSettings": { + "maxReadRequestUnits": 1002 + }, + "contributorInsightsSpecification": { + "enabled": true + } + }, + { + "indexName": "gsi2", + "readOnDemandThroughputSettings": { + "maxReadRequestUnits": 2001 + }, + "contributorInsightsSpecification": { + "enabled": true + } + } + ], + "tableClass": "STANDARD_INFREQUENT_ACCESS", + "contributorInsightsSpecification": { + "enabled": true + }, + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "readOnDemandThroughputSettings": { + "maxReadRequestUnits": 222 + } + }, + { + "region": "us-east-1", + "globalSecondaryIndexes": [ + { + "indexName": "gsi1", + "readOnDemandThroughputSettings": { + "maxReadRequestUnits": 1002 + }, + "contributorInsightsSpecification": { + "enabled": true + } + }, + { + "indexName": "gsi2", + "readOnDemandThroughputSettings": { + "maxReadRequestUnits": 2001 + }, + "contributorInsightsSpecification": { + "enabled": true + } + } + ], + "tableClass": "STANDARD_INFREQUENT_ACCESS", + "kinesisStreamSpecification": { + "streamArn": { + "Fn::GetAtt": [ + "Stream790BDEE4", + "Arn" + ] + } + }, + "contributorInsightsSpecification": { + "enabled": true + }, + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "tags": [ + { + "key": "primaryTableTagKey", + "value": "primaryTableTagValue" + } + ] + } + ], + "sseSpecification": { + "sseEnabled": true, + "sseType": "KMS" + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + }, + "tableName": "my-global-table", + "timeToLiveSpecification": { + "attributeName": "attr", + "enabled": true + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnGlobalTable", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.TableBaseV2", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-global-table/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-global-table/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "aws-cdk-global-table-integ": { + "id": "aws-cdk-global-table-integ", + "path": "aws-cdk-global-table-integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "aws-cdk-global-table-integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "aws-cdk-global-table-integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "aws-cdk-global-table-integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-global-table-integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-global-table-integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.ts new file mode 100644 index 0000000000000..c2070e0b45754 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.ondemand.ts @@ -0,0 +1,60 @@ +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { AttributeType, Billing, TableV2, TableClass, TableEncryptionV2 } from 'aws-cdk-lib/aws-dynamodb'; +import { Stream } from 'aws-cdk-lib/aws-kinesis'; +import { Construct } from 'constructs'; + +class TestStack extends Stack { + public constructor(scope: Construct, id: string, props: StackProps) { + super(scope, id, props); + + const stream = new Stream(this, 'Stream'); + + new TableV2(this, 'GlobalTable', { + tableName: 'my-global-table', + partitionKey: { name: 'pk', type: AttributeType.STRING }, + sortKey: { name: 'sk', type: AttributeType.NUMBER }, + billing: Billing.onDemand(), + encryption: TableEncryptionV2.awsManagedKey(), + contributorInsights: true, + pointInTimeRecovery: true, + tableClass: TableClass.STANDARD_INFREQUENT_ACCESS, + timeToLiveAttribute: 'attr', + removalPolicy: RemovalPolicy.DESTROY, + kinesisStream: stream, + replicas: [ + { + region: 'eu-west-1', + maxReadRequestUnits: 222, + }, + ], + globalSecondaryIndexes: [ + { + indexName: 'gsi1', + partitionKey: { name: 'pk', type: AttributeType.STRING }, + maxReadRequestUnits: 1002, + }, + { + indexName: 'gsi2', + partitionKey: { name: 'pk', type: AttributeType.STRING }, + maxReadRequestUnits: 2001, + maxWriteRequestUnits: 2001, + }, + ], + localSecondaryIndexes: [ + { + indexName: 'lsi', + sortKey: { name: 'sk', type: AttributeType.NUMBER }, + }, + ], + tags: [{ key: 'primaryTableTagKey', value: 'primaryTableTagValue' }], + }); + } +} + +const app = new App(); +new IntegTest(app, 'aws-cdk-global-table-integ', { + testCases: [new TestStack(app, 'aws-cdk-global-table', { env: { region: 'us-east-1' } })], + regions: ['us-east-1'], + stackUpdateWorkflow: false, +}); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.js.snapshot/integ.json index 32e11a1d2250a..5e8e335699b08 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.js.snapshot/integ.json @@ -5,16 +5,6 @@ "stacks": [ "ResourcePolicyTest-v2" ], - "regions": [ - "us-east-1" - ], - "cdkCommandOptions": { - "deploy": { - "args": { - "rollback": true - } - } - }, "assertionStack": "table-v2-resource-policy-integ-test/DefaultTest/DeployAssert", "assertionStackName": "tablev2resourcepolicyintegtestDefaultTestDeployAssertBE3353C7" } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.js.snapshot/tree.json index 3a0a1c50405d4..8417b42605972 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb-v2.policy.js.snapshot/tree.json @@ -71,7 +71,7 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_dynamodb.TableV2", + "fqn": "aws-cdk-lib.aws_dynamodb.TableBaseV2", "version": "0.0.0" } }, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.assets.json index fd6b84f880be7..a06498ad4deee 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.assets.json @@ -1,7 +1,7 @@ { - "version": "20.0.0", + "version": "36.0.0", "files": { - "6721dc6f360c620369b9c3be4b289ff536e0faa87f39bac615b56ff31b2c609e": { + "4413d3171770b8ef5d6566130e7d33ddf852ba9ac51a59b9aea634446217bb3f": { "source": { "path": "aws-cdk-dynamodb.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "6721dc6f360c620369b9c3be4b289ff536e0faa87f39bac615b56ff31b2c609e.json", + "objectKey": "4413d3171770b8ef5d6566130e7d33ddf852ba9ac51a59b9aea634446217bb3f.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.template.json index 4b943cf19b09d..6c7b3cd8fad33 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.template.json @@ -3,19 +3,23 @@ "TableCD117FA1": { "Type": "AWS::DynamoDB::Table", "Properties": { - "KeySchema": [ + "AttributeDefinitions": [ { "AttributeName": "hashKey", - "KeyType": "HASH" + "AttributeType": "S" } ], - "AttributeDefinitions": [ + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ { "AttributeName": "hashKey", - "AttributeType": "S" + "KeyType": "HASH" } ], - "BillingMode": "PAY_PER_REQUEST" + "OnDemandThroughput": { + "MaxReadRequestUnits": 100, + "MaxWriteRequestUnits": 200 + } }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -23,16 +27,6 @@ "TableWithGlobalAndLocalSecondaryIndexBC540710": { "Type": "AWS::DynamoDB::Table", "Properties": { - "KeySchema": [ - { - "AttributeName": "hashKey", - "KeyType": "HASH" - }, - { - "AttributeName": "sortKey", - "KeyType": "RANGE" - } - ], "AttributeDefinitions": [ { "AttributeName": "hashKey", @@ -65,6 +59,10 @@ "KeyType": "HASH" } ], + "OnDemandThroughput": { + "MaxReadRequestUnits": 100, + "MaxWriteRequestUnits": 100 + }, "Projection": { "ProjectionType": "ALL" } @@ -146,6 +144,16 @@ } } ], + "KeySchema": [ + { + "AttributeName": "hashKey", + "KeyType": "HASH" + }, + { + "AttributeName": "sortKey", + "KeyType": "RANGE" + } + ], "LocalSecondaryIndexes": [ { "IndexName": "LSI-PartitionAndTableSortKey", @@ -250,12 +258,6 @@ "TableWithGlobalSecondaryIndexCC8E841E": { "Type": "AWS::DynamoDB::Table", "Properties": { - "KeySchema": [ - { - "AttributeName": "hashKey", - "KeyType": "HASH" - } - ], "AttributeDefinitions": [ { "AttributeName": "hashKey", @@ -280,6 +282,12 @@ "ProjectionType": "ALL" } } + ], + "KeySchema": [ + { + "AttributeName": "hashKey", + "KeyType": "HASH" + } ] }, "UpdateReplacePolicy": "Delete", @@ -288,16 +296,6 @@ "TableWithLocalSecondaryIndex4DA3D08F": { "Type": "AWS::DynamoDB::Table", "Properties": { - "KeySchema": [ - { - "AttributeName": "hashKey", - "KeyType": "HASH" - }, - { - "AttributeName": "sortKey", - "KeyType": "RANGE" - } - ], "AttributeDefinitions": [ { "AttributeName": "hashKey", @@ -313,6 +311,16 @@ } ], "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "hashKey", + "KeyType": "HASH" + }, + { + "AttributeName": "sortKey", + "KeyType": "RANGE" + } + ], "LocalSecondaryIndexes": [ { "IndexName": "LSI-PartitionAndSortKey", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/cdk.out index 588d7b269d34f..1f0068d32659a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"20.0.0"} \ No newline at end of file +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/integ.json index 8c1bf3f2a284a..41061cbfbe3ba 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "20.0.0", + "version": "36.0.0", "testCases": { "integ.dynamodb.ondemand": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/manifest.json index fda20497ff2a4..46a693620203b 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/manifest.json @@ -1,12 +1,6 @@ { - "version": "20.0.0", + "version": "36.0.0", "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, "aws-cdk-dynamodb.assets": { "type": "cdk:asset-manifest", "properties": { @@ -20,10 +14,11 @@ "environment": "aws://unknown-account/unknown-region", "properties": { "templateFile": "aws-cdk-dynamodb.template.json", + "terminationProtection": false, "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/6721dc6f360c620369b9c3be4b289ff536e0faa87f39bac615b56ff31b2c609e.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/4413d3171770b8ef5d6566130e7d33ddf852ba9ac51a59b9aea634446217bb3f.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -77,6 +72,12 @@ ] }, "displayName": "aws-cdk-dynamodb" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } } } } \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/tree.json index e5ea52068becf..c149e06017f7a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/tree.json @@ -4,14 +4,6 @@ "id": "App", "path": "", "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" - } - }, "aws-cdk-dynamodb": { "id": "aws-cdk-dynamodb", "path": "aws-cdk-dynamodb", @@ -26,23 +18,27 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", "aws:cdk:cloudformation:props": { - "keySchema": [ + "attributeDefinitions": [ { "attributeName": "hashKey", - "keyType": "HASH" + "attributeType": "S" } ], - "attributeDefinitions": [ + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ { "attributeName": "hashKey", - "attributeType": "S" + "keyType": "HASH" } ], - "billingMode": "PAY_PER_REQUEST" + "onDemandThroughput": { + "maxReadRequestUnits": 100, + "maxWriteRequestUnits": 200 + } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-dynamodb.CfnTable", + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", "version": "0.0.0" } }, @@ -50,13 +46,13 @@ "id": "ScalingRole", "path": "aws-cdk-dynamodb/Table/ScalingRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-dynamodb.Table", + "fqn": "aws-cdk-lib.aws_dynamodb.Table", "version": "0.0.0" } }, @@ -70,16 +66,6 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", "aws:cdk:cloudformation:props": { - "keySchema": [ - { - "attributeName": "hashKey", - "keyType": "HASH" - }, - { - "attributeName": "sortKey", - "keyType": "RANGE" - } - ], "attributeDefinitions": [ { "attributeName": "hashKey", @@ -114,6 +100,10 @@ ], "projection": { "projectionType": "ALL" + }, + "onDemandThroughput": { + "maxReadRequestUnits": 100, + "maxWriteRequestUnits": 100 } }, { @@ -193,6 +183,16 @@ } } ], + "keySchema": [ + { + "attributeName": "hashKey", + "keyType": "HASH" + }, + { + "attributeName": "sortKey", + "keyType": "RANGE" + } + ], "localSecondaryIndexes": [ { "indexName": "LSI-PartitionAndTableSortKey", @@ -293,7 +293,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-dynamodb.CfnTable", + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", "version": "0.0.0" } }, @@ -301,13 +301,13 @@ "id": "ScalingRole", "path": "aws-cdk-dynamodb/TableWithGlobalAndLocalSecondaryIndex/ScalingRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-dynamodb.Table", + "fqn": "aws-cdk-lib.aws_dynamodb.Table", "version": "0.0.0" } }, @@ -321,12 +321,6 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", "aws:cdk:cloudformation:props": { - "keySchema": [ - { - "attributeName": "hashKey", - "keyType": "HASH" - } - ], "attributeDefinitions": [ { "attributeName": "hashKey", @@ -351,11 +345,17 @@ "projectionType": "ALL" } } + ], + "keySchema": [ + { + "attributeName": "hashKey", + "keyType": "HASH" + } ] } }, "constructInfo": { - "fqn": "@aws-cdk/aws-dynamodb.CfnTable", + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", "version": "0.0.0" } }, @@ -363,13 +363,13 @@ "id": "ScalingRole", "path": "aws-cdk-dynamodb/TableWithGlobalSecondaryIndex/ScalingRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-dynamodb.Table", + "fqn": "aws-cdk-lib.aws_dynamodb.Table", "version": "0.0.0" } }, @@ -383,16 +383,6 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", "aws:cdk:cloudformation:props": { - "keySchema": [ - { - "attributeName": "hashKey", - "keyType": "HASH" - }, - { - "attributeName": "sortKey", - "keyType": "RANGE" - } - ], "attributeDefinitions": [ { "attributeName": "hashKey", @@ -408,6 +398,16 @@ } ], "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "hashKey", + "keyType": "HASH" + }, + { + "attributeName": "sortKey", + "keyType": "RANGE" + } + ], "localSecondaryIndexes": [ { "indexName": "LSI-PartitionAndSortKey", @@ -429,7 +429,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-dynamodb.CfnTable", + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", "version": "0.0.0" } }, @@ -437,26 +437,50 @@ "id": "ScalingRole", "path": "aws-cdk-dynamodb/TableWithLocalSecondaryIndex/ScalingRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-dynamodb.Table", + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-dynamodb/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-dynamodb/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", "version": "0.0.0" } } }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.85" + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" } } } \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.ts index 5a82c86155d65..e28fe9af89c43 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.ts @@ -45,6 +45,8 @@ new Table(stack, TABLE, { billingMode: BillingMode.PAY_PER_REQUEST, partitionKey: TABLE_PARTITION_KEY, removalPolicy: RemovalPolicy.DESTROY, + maxReadRequestUnits: 100, + maxWriteRequestUnits: 200, }); const tableWithGlobalAndLocalSecondaryIndex = new Table(stack, TABLE_WITH_GLOBAL_AND_LOCAL_SECONDARY_INDEX, { @@ -63,6 +65,8 @@ Tags.of(tableWithGlobalAndLocalSecondaryIndex).add('Environment', 'Production'); tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ indexName: GSI_TEST_CASE_1, partitionKey: GSI_PARTITION_KEY, + maxReadRequestUnits: 100, + maxWriteRequestUnits: 100, }); tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ indexName: GSI_TEST_CASE_2, diff --git a/packages/aws-cdk-lib/aws-dynamodb/README.md b/packages/aws-cdk-lib/aws-dynamodb/README.md index 83d3e35c7d2f2..24e09c418b6ae 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/README.md +++ b/packages/aws-cdk-lib/aws-dynamodb/README.md @@ -148,6 +148,7 @@ Note: You can create an instance of the `TableV2` construct with as many `replic The `TableV2` construct can be configured with on-demand or provisioned billing: * On-demand - The default option. This is a flexible billing option capable of serving requests without capacity planning. The billing mode will be `PAY_PER_REQUEST`. +* You can optionally specify the `maxReadRequestUnits` or `maxWriteRequestUnits` on individual tables and associated global secondary indexes (GSIs). When you configure maximum throughput for an on-demand table, throughput requests that exceed the maximum amount specified will be throttled. * Provisioned - Specify the `readCapacity` and `writeCapacity` that you need for your application. The billing mode will be `PROVISIONED`. Capacity can be configured using one of the following modes: * Fixed - provisioned throughput capacity is configured with a fixed number of I/O operations per second. * Autoscaled - provisioned throughput capacity is dynamically adjusted on your behalf in response to actual traffic patterns. @@ -163,6 +164,18 @@ const table = new dynamodb.TableV2(this, 'Table', { }) ``` +The following example shows how to configure `TableV2` with on-demand billing with optional maximum throughput configured: + +```ts +const table = new dynamodb.TableV2(this, 'Table', { + partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING }, + billing: dynamodb.Billing.onDemand({ + maxReadRequestUnits: 100, + maxWriteRequestUnits: 115, + }), +}) +``` + When using provisioned billing, you must also specify `readCapacity` and `writeCapacity`. You can choose to configure `readCapacity` with fixed capacity or autoscaled capacity, but `writeCapacity` can only be configured with autoscaled capacity. The following example shows how to configure `TableV2` with provisioned billing: ```ts diff --git a/packages/aws-cdk-lib/aws-dynamodb/TABLE_V1_API.md b/packages/aws-cdk-lib/aws-dynamodb/TABLE_V1_API.md index ae5049af56cd8..34cf25434d6b2 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/TABLE_V1_API.md +++ b/packages/aws-cdk-lib/aws-dynamodb/TABLE_V1_API.md @@ -46,6 +46,17 @@ const table = new dynamodb.Table(this, 'Table', { }); ``` +You can specify a maximum read or write request units when using PAY_PER_REQUEST billing mode: + +```ts +const table = new dynamodb.Table(this, 'Table', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, + billingMode: dynamodb.BillingMode.PAY_PER_REQUEST, + maxReadRequestUnits: 100, + maxWriteRequestUnits: 200, +}); +``` + Further reading: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode. diff --git a/packages/aws-cdk-lib/aws-dynamodb/lib/billing.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/billing.ts index c319a7023f709..bc05c312226fa 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/lib/billing.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/billing.ts @@ -16,6 +16,27 @@ export interface ThroughputProps { readonly writeCapacity: Capacity; } +/** + * Properties used to configure maximum throughput for an on-demand table. + */ +export interface MaxThroughputProps { + /** + * The max read request units. + * @default - if table mode is on-demand and this property is undefined, + * no maximum throughput limit will be put in place for read requests. + * This property is only applicable for tables using on-demand mode. + */ + readonly maxReadRequestUnits?: number; + + /** + * The max write request units. + * @default - if table mode is on-demand and this property is undefined, + * no maximum throughput limit will be put in place for write requests. + * This property is only applicable for tables using on-demand mode. + */ + readonly maxWriteRequestUnits?: number; +} + /** * Represents how capacity is managed and how you are charged for read and write throughput * for a DynamoDB table. @@ -26,14 +47,14 @@ export abstract class Billing { * * Note: Billing mode will be PAY_PER_REQUEST. */ - public static onDemand(): Billing { + public static onDemand(props?: MaxThroughputProps): Billing { return new (class extends Billing { public _renderReadCapacity() { - return undefined; + return props?.maxReadRequestUnits; } public _renderWriteCapacity() { - return undefined; + return props?.maxWriteRequestUnits; } }) (BillingMode.PAY_PER_REQUEST); } diff --git a/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts index a309c994d33ad..65e3c588968e5 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts @@ -40,6 +40,15 @@ export interface ReplicaGlobalSecondaryIndexOptions { * @default - inherited from the primary table */ readonly readCapacity?: Capacity; + + /** + * The maximum read request units for a specific global secondary index on a replica table. + * + * Note: This can only be configured if primary table billing is PAY_PER_REQUEST. + * + * @default - inherited from the primary table + */ + readonly maxReadRequestUnits?: number; } /** @@ -75,6 +84,24 @@ export interface GlobalSecondaryIndexPropsV2 extends SecondaryIndexProps { * @default - inherited from the primary table. */ readonly writeCapacity?: Capacity; + + /** + * The maximum read request units. + * + * Note: This can only be configured if the primary table billing is PAY_PER_REQUEST. + * + * @default - inherited from the primary table. + */ + readonly maxReadRequestUnits?: number; + + /** + * The maximum write request units. + * + * Note: This can only be configured if the primary table billing is PAY_PER_REQUEST. + * + * @default - inherited from the primary table. + */ + readonly maxWriteRequestUnits?: number; } /** @@ -149,6 +176,15 @@ export interface ReplicaTableProps extends TableOptionsV2 { */ readonly readCapacity?: Capacity; + /** + * The maxium read request units. + * + * Note: This can only be configured if the primary table billing is PAY_PER_REQUEST. + * + * @default - inherited from the primary table + */ + readonly maxReadRequestUnits?: number; + /** * Options used to configure global secondary index properties. * @@ -459,6 +495,9 @@ export class TableV2 extends TableBaseV2 { private readonly readProvisioning?: CfnGlobalTable.ReadProvisionedThroughputSettingsProperty; private readonly writeProvisioning?: CfnGlobalTable.WriteProvisionedThroughputSettingsProperty; + private readonly maxReadRequestUnits?: number; + private readonly maxWriteRequestUnits?: number; + private readonly replicaTables = new Map(); private readonly replicaKeys: { [region: string]: IKey } = {}; private readonly replicaTableArns: string[] = []; @@ -467,6 +506,7 @@ export class TableV2 extends TableBaseV2 { private readonly globalSecondaryIndexes = new Map(); private readonly localSecondaryIndexes = new Map(); private readonly globalSecondaryIndexReadCapacitys = new Map(); + private readonly globalSecondaryIndexMaxReadUnits = new Map(); public constructor(scope: Construct, id: string, props: TablePropsV2) { super(scope, id, { physicalName: props.tableName ?? PhysicalName.GENERATE_IF_NEEDED }); @@ -485,9 +525,15 @@ export class TableV2 extends TableBaseV2 { this.addKey(props.sortKey, RANGE_KEY_TYPE); } - this.billingMode = props.billing?.mode ?? BillingMode.PAY_PER_REQUEST; - this.readProvisioning = props.billing?._renderReadCapacity(); - this.writeProvisioning = props.billing?._renderWriteCapacity(); + if (props.billing?.mode === BillingMode.PAY_PER_REQUEST || props.billing?.mode === undefined) { + this.maxReadRequestUnits = props.billing?._renderReadCapacity(); + this.maxWriteRequestUnits = props.billing?._renderWriteCapacity(); + this.billingMode = BillingMode.PAY_PER_REQUEST; + } else { + this.readProvisioning = props.billing?._renderReadCapacity(); + this.writeProvisioning = props.billing?._renderWriteCapacity(); + this.billingMode = props.billing.mode; + } props.globalSecondaryIndexes?.forEach(gsi => this.addGlobalSecondaryIndex(gsi)); props.localSecondaryIndexes?.forEach(lsi => this.addLocalSecondaryIndex(lsi)); @@ -501,6 +547,9 @@ export class TableV2 extends TableBaseV2 { localSecondaryIndexes: Lazy.any({ produce: () => this.renderLocalIndexes() }, { omitEmptyArray: true }), billingMode: this.billingMode, writeProvisionedThroughputSettings: this.writeProvisioning, + writeOnDemandThroughputSettings: this.maxWriteRequestUnits + ? { maxWriteRequestUnits: this.maxWriteRequestUnits } + : undefined, streamSpecification: Lazy.any( { produce: () => props.dynamoStream ? { streamViewType: props.dynamoStream } : this.renderStreamSpecification() }, ), @@ -636,6 +685,11 @@ export class TableV2 extends TableBaseV2 { ? props.readCapacity._renderReadCapacity() : this.readProvisioning, tags: props.tags, + readOnDemandThroughputSettings: props.maxReadRequestUnits + ? { maxReadRequestUnits: props.maxReadRequestUnits } + : this.maxReadRequestUnits + ? { maxReadRequestUnits: this.maxReadRequestUnits } + : undefined, resourcePolicy: resourcePolicy ? { policyDocument: resourcePolicy } : undefined, @@ -649,11 +703,18 @@ export class TableV2 extends TableBaseV2 { props.readCapacity && this.globalSecondaryIndexReadCapacitys.set(props.indexName, props.readCapacity); const writeProvisionedThroughputSettings = props.writeCapacity ? props.writeCapacity._renderWriteCapacity() : this.writeProvisioning; + props.maxReadRequestUnits && this.globalSecondaryIndexMaxReadUnits.set(props.indexName, props.maxReadRequestUnits); + + const writeOnDemandThroughputSettings: CfnGlobalTable.WriteOnDemandThroughputSettingsProperty | undefined = props.maxWriteRequestUnits + ? { maxWriteRequestUnits: props.maxWriteRequestUnits } + : undefined; + return { indexName: props.indexName, keySchema, projection, writeProvisionedThroughputSettings, + writeOnDemandThroughputSettings, }; } @@ -678,18 +739,24 @@ export class TableV2 extends TableBaseV2 { const indexName = gsi.indexName; let contributorInsights = this.tableOptions.contributorInsights; let readCapacity = this.globalSecondaryIndexReadCapacitys.get(indexName); - + let maxReadRequestUnits = this.globalSecondaryIndexMaxReadUnits.get(indexName); if (indexNamesFromOptions.includes(indexName)) { const indexOptions = options[indexName]; contributorInsights = indexOptions.contributorInsights; readCapacity = indexOptions.readCapacity; + maxReadRequestUnits = indexOptions.maxReadRequestUnits; } const readProvisionedThroughputSettings = readCapacity?._renderReadCapacity() ?? this.readProvisioning; + const readOnDemandThroughputSettings: CfnGlobalTable.ReadOnDemandThroughputSettingsProperty | undefined = maxReadRequestUnits + ? { maxReadRequestUnits: maxReadRequestUnits } + : undefined; + replicaGlobalSecondaryIndexes.push({ indexName, readProvisionedThroughputSettings, + readOnDemandThroughputSettings, contributorInsightsSpecification: contributorInsights !== undefined ? { enabled: contributorInsights } : undefined, diff --git a/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts index a9127cabf957a..33bd67411b000 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts @@ -233,6 +233,25 @@ export interface TableOptions extends SchemaOptions { */ readonly writeCapacity?: number; + /** + * The maximum read request units for the table. Careful if you add Global Secondary Indexes, as + * those will share the table's maximum on-demand throughput. + * + * Can only be provided if billingMode is PAY_PER_REQUEST. + * + * @default - on-demand throughput is disabled + */ + readonly maxReadRequestUnits?: number; + /** + * The write request units for the table. Careful if you add Global Secondary Indexes, as + * those will share the table's maximum on-demand throughput. + * + * Can only be provided if billingMode is PAY_PER_REQUEST. + * + * @default - on-demand throughput is disabled + */ + readonly maxWriteRequestUnits?: number; + /** * Specify how you are charged for read and write throughput and how you manage capacity. * @@ -418,6 +437,24 @@ export interface GlobalSecondaryIndexProps extends SecondaryIndexProps, SchemaOp * @default 5 */ readonly writeCapacity?: number; + + /** + * The maximum read request units for the global secondary index. + * + * Can only be provided if table billingMode is PAY_PER_REQUEST. + * + * @default - on-demand throughput is disabled + */ + readonly maxReadRequestUnits?: number; + + /** + * The maximum write request units for the global secondary index. + * + * Can only be provided if table billingMode is PAY_PER_REQUEST. + * + * @default - on-demand throughput is disabled + */ + readonly maxWriteRequestUnits?: number; } /** @@ -1124,6 +1161,13 @@ export class Table extends TableBase { readCapacityUnits: props.readCapacity || 5, writeCapacityUnits: props.writeCapacity || 5, }, + ...(props.maxReadRequestUnits || props.maxWriteRequestUnits ? + { + onDemandThroughput: this.billingMode === BillingMode.PROVISIONED ? undefined : { + maxReadRequestUnits: props.maxReadRequestUnits || undefined, + maxWriteRequestUnits: props.maxWriteRequestUnits || undefined, + }, + } : undefined), sseSpecification, streamSpecification, tableClass: props.tableClass, @@ -1189,6 +1233,13 @@ export class Table extends TableBase { readCapacityUnits: props.readCapacity || 5, writeCapacityUnits: props.writeCapacity || 5, }, + ...(props.maxReadRequestUnits || props.maxWriteRequestUnits ? + { + onDemandThroughput: this.billingMode === BillingMode.PROVISIONED ? undefined : { + maxReadRequestUnits: props.maxReadRequestUnits || undefined, + maxWriteRequestUnits: props.maxWriteRequestUnits || undefined, + }, + } : undefined), }); this.secondaryIndexSchemas.set(props.indexName, { diff --git a/packages/aws-cdk-lib/aws-dynamodb/test/billing.test.ts b/packages/aws-cdk-lib/aws-dynamodb/test/billing.test.ts index e62cb924ab282..adda6cb779a97 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/test/billing.test.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/test/billing.test.ts @@ -48,3 +48,29 @@ describe('provisioned billing', () => { expect(billing.mode).toEqual(BillingMode.PROVISIONED); }); }); + +describe('max throughput on-demand billing', () => { + // GIVEN + let billing: Billing; + beforeEach(() => { + billing = Billing.onDemand({ + maxReadRequestUnits: 10, + maxWriteRequestUnits: 100, + }); + }); + + test('render read capacity', () => { + // WHEN / THEN + expect(billing._renderReadCapacity()).toBe(10); + }); + + test('render write capacity', () => { + // WHEN / THEN + expect(billing._renderWriteCapacity()).toBe(100); + }); + + test('billing mode is PAY_PER_REQUEST', () => { + // WHEN / THEN + expect(billing.mode).toEqual(BillingMode.PAY_PER_REQUEST); + }); +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts b/packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts index 39598ee4f588a..4be16524b2ca3 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts @@ -762,6 +762,75 @@ describe('when billing mode is PAY_PER_REQUEST', () => { writeCapacity: 1, })).toThrow(/PAY_PER_REQUEST/); }); + + test('when specifying maximum throughput for on-demand', () => { + stack = new Stack(); + new Table(stack, CONSTRUCT_NAME, { + tableName: TABLE_NAME, + billingMode: BillingMode.PAY_PER_REQUEST, + partitionKey: TABLE_PARTITION_KEY, + maxReadRequestUnits: 10, + maxWriteRequestUnits: 5, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::DynamoDB::Table', + { + KeySchema: [ + { AttributeName: 'hashKey', KeyType: 'HASH' }, + ], + BillingMode: 'PAY_PER_REQUEST', + AttributeDefinitions: [ + { AttributeName: 'hashKey', AttributeType: 'S' }, + ], + TableName: 'MyTable', + OnDemandThroughput: { + MaxReadRequestUnits: 10, + MaxWriteRequestUnits: 5, + }, + }, + ); + }); + + test('when specifying maximum throughput for on-demand-indexes', () => { + stack = new Stack(); + const table = new Table(stack, CONSTRUCT_NAME, { + tableName: TABLE_NAME, + billingMode: BillingMode.PAY_PER_REQUEST, + partitionKey: TABLE_PARTITION_KEY, + maxReadRequestUnits: 10, + maxWriteRequestUnits: 5, + }); + table.addGlobalSecondaryIndex({ + maxReadRequestUnits: 10, + maxWriteRequestUnits: 20, + indexName: 'gsi1', + partitionKey: { name: 'pk', type: AttributeType.STRING }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::DynamoDB::Table', + { + KeySchema: [{ AttributeName: 'hashKey', KeyType: 'HASH' }], + BillingMode: 'PAY_PER_REQUEST', + AttributeDefinitions: [ + { AttributeName: 'hashKey', AttributeType: 'S' }, + { AttributeName: 'pk', AttributeType: 'S' }, + ], + TableName: 'MyTable', + OnDemandThroughput: { + MaxReadRequestUnits: 10, + MaxWriteRequestUnits: 5, + }, + GlobalSecondaryIndexes: [{ + IndexName: 'gsi1', + KeySchema: [{ AttributeName: 'pk', KeyType: 'HASH' }], + OnDemandThroughput: { + MaxReadRequestUnits: 10, + MaxWriteRequestUnits: 20, + }, + }], + }, + ); + }); }); describe('schema details', () => { diff --git a/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts b/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts index 81e9205211a0b..63bbf3319b73e 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts @@ -1029,6 +1029,161 @@ describe('table', () => { table.replica('us-west-2'); }).toThrow('Replica tables are not supported in a region agnostic stack'); }); + + test('with on-demand maximum throughput', () => { + // GIVEN + const stack = new Stack(undefined, 'Stack'); + + // WHEN + new TableV2(stack, 'Table', { + partitionKey: { name: 'pk', type: AttributeType.STRING }, + billing: Billing.onDemand({ + maxReadRequestUnits: 10, + maxWriteRequestUnits: 10, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DynamoDB::GlobalTable', { + KeySchema: [ + { AttributeName: 'pk', KeyType: 'HASH' }, + ], + AttributeDefinitions: [ + { AttributeName: 'pk', AttributeType: 'S' }, + ], + WriteOnDemandThroughputSettings: { + MaxWriteRequestUnits: 10, + }, + BillingMode: 'PAY_PER_REQUEST', + StreamSpecification: Match.absent(), + Replicas: [ + { + Region: { + Ref: 'AWS::Region', + }, + ReadOnDemandThroughputSettings: { + MaxReadRequestUnits: 10, + }, + }, + ], + }); + Template.fromStack(stack).hasResource('AWS::DynamoDB::GlobalTable', { DeletionPolicy: CfnDeletionPolicy.RETAIN }); + }); + + test('with on-demand maximum throughput - read only', () => { + // GIVEN + const stack = new Stack(undefined, 'Stack'); + + // WHEN + new TableV2(stack, 'Table', { + partitionKey: { name: 'pk', type: AttributeType.STRING }, + billing: Billing.onDemand({ + maxReadRequestUnits: 10, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DynamoDB::GlobalTable', { + KeySchema: [ + { AttributeName: 'pk', KeyType: 'HASH' }, + ], + AttributeDefinitions: [ + { AttributeName: 'pk', AttributeType: 'S' }, + ], + BillingMode: 'PAY_PER_REQUEST', + StreamSpecification: Match.absent(), + Replicas: [ + { + Region: { + Ref: 'AWS::Region', + }, + ReadOnDemandThroughputSettings: { + MaxReadRequestUnits: 10, + }, + }, + ], + }); + Template.fromStack(stack).hasResource('AWS::DynamoDB::GlobalTable', { DeletionPolicy: CfnDeletionPolicy.RETAIN }); + }); + + test('with on-demand maximum throughput - index', () => { + // GIVEN + const stack = new Stack(undefined, 'Stack'); + + // WHEN + new TableV2(stack, 'Table', { + partitionKey: { name: 'pk', type: AttributeType.STRING }, + globalSecondaryIndexes: [ + { + indexName: 'gsi1', + partitionKey: { name: 'pk', type: AttributeType.STRING }, + maxReadRequestUnits: 100, + }, + { + indexName: 'gsi2', + partitionKey: { name: 'pk', type: AttributeType.STRING }, + maxReadRequestUnits: 1, + maxWriteRequestUnits: 1, + }, + ], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DynamoDB::GlobalTable', { + KeySchema: [ + { AttributeName: 'pk', KeyType: 'HASH' }, + ], + AttributeDefinitions: [ + { AttributeName: 'pk', AttributeType: 'S' }, + ], + GlobalSecondaryIndexes: [ + { + IndexName: 'gsi1', + KeySchema: [ + { AttributeName: 'pk', KeyType: 'HASH' }, + ], + Projection: { + ProjectionType: 'ALL', + }, + }, + { + IndexName: 'gsi2', + KeySchema: [ + { AttributeName: 'pk', KeyType: 'HASH' }, + ], + Projection: { + ProjectionType: 'ALL', + }, + WriteOnDemandThroughputSettings: { + MaxWriteRequestUnits: 1, + }, + }, + ], + BillingMode: 'PAY_PER_REQUEST', + StreamSpecification: Match.absent(), + Replicas: [ + { + Region: { + Ref: 'AWS::Region', + }, + GlobalSecondaryIndexes: [{ + IndexName: 'gsi1', + ReadOnDemandThroughputSettings: { + MaxReadRequestUnits: 100, + }, + }, + { + IndexName: 'gsi2', + ReadOnDemandThroughputSettings: { + MaxReadRequestUnits: 1, + }, + }], + }, + ], + }); + Template.fromStack(stack).hasResource('AWS::DynamoDB::GlobalTable', { DeletionPolicy: CfnDeletionPolicy.RETAIN }); + }); + }); describe('replica tables', () => {