-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dynamodb): TableV2 supports imports, drift detection, and better…
… control over replicas (#27023) This PR is for the implementation of the `TableV2` construct which provides support for the `GlobalTable` resource. Please reference the following RFC: [aws/aws-cdk-rfcs@master/text/0510-dynamodb-global-table.md](https://github.com/aws/aws-cdk-rfcs/blob/master/text/0510-dynamodb-global-table.md?rgh-link-date=2023-07-28T17%3A49%3A45Z) Closes #16118 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
36 changed files
with
41,887 additions
and
538 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/aws-cdk-global-table.assets.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": "34.0.0", | ||
"files": { | ||
"68a3bb36a940031cf3b515e0cad696adef98469abd9e58c2eb45fb68296fcd2e": { | ||
"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": "68a3bb36a940031cf3b515e0cad696adef98469abd9e58c2eb45fb68296fcd2e.json", | ||
"region": "us-east-1", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-us-east-1" | ||
} | ||
} | ||
} | ||
}, | ||
"dockerImages": {} | ||
} |
302 changes: 302 additions & 0 deletions
302
...st/aws-dynamodb/test/integ.table-v2-global.js.snapshot/aws-cdk-global-table.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,302 @@ | ||
{ | ||
"Resources": { | ||
"Stream790BDEE4": { | ||
"Type": "AWS::Kinesis::Stream", | ||
"Properties": { | ||
"RetentionPeriodHours": 24, | ||
"ShardCount": 1, | ||
"StreamEncryption": { | ||
"Fn::If": [ | ||
"AwsCdkKinesisEncryptedStreamsUnsupportedRegions", | ||
{ | ||
"Ref": "AWS::NoValue" | ||
}, | ||
{ | ||
"EncryptionType": "KMS", | ||
"KeyId": "alias/aws/kinesis" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"Resource": { | ||
"Type": "AWS::DynamoDB::GlobalTable", | ||
"Properties": { | ||
"AttributeDefinitions": [ | ||
{ | ||
"AttributeName": "pk", | ||
"AttributeType": "S" | ||
}, | ||
{ | ||
"AttributeName": "sk", | ||
"AttributeType": "N" | ||
} | ||
], | ||
"BillingMode": "PROVISIONED", | ||
"GlobalSecondaryIndexes": [ | ||
{ | ||
"IndexName": "gsi1", | ||
"KeySchema": [ | ||
{ | ||
"AttributeName": "pk", | ||
"KeyType": "HASH" | ||
} | ||
], | ||
"Projection": { | ||
"ProjectionType": "ALL" | ||
}, | ||
"WriteProvisionedThroughputSettings": { | ||
"WriteCapacityAutoScalingSettings": { | ||
"MaxCapacity": 20, | ||
"MinCapacity": 1, | ||
"TargetTrackingScalingPolicyConfiguration": { | ||
"TargetValue": 60 | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"IndexName": "gsi2", | ||
"KeySchema": [ | ||
{ | ||
"AttributeName": "pk", | ||
"KeyType": "HASH" | ||
} | ||
], | ||
"Projection": { | ||
"ProjectionType": "ALL" | ||
}, | ||
"WriteProvisionedThroughputSettings": { | ||
"WriteCapacityAutoScalingSettings": { | ||
"MaxCapacity": 30, | ||
"MinCapacity": 1, | ||
"TargetTrackingScalingPolicyConfiguration": { | ||
"TargetValue": 70 | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"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", | ||
"ReadProvisionedThroughputSettings": { | ||
"ReadCapacityUnits": 10 | ||
} | ||
}, | ||
{ | ||
"ContributorInsightsSpecification": { | ||
"Enabled": false | ||
}, | ||
"IndexName": "gsi2", | ||
"ReadProvisionedThroughputSettings": { | ||
"ReadCapacityUnits": 10 | ||
} | ||
} | ||
], | ||
"PointInTimeRecoverySpecification": { | ||
"PointInTimeRecoveryEnabled": true | ||
}, | ||
"ReadProvisionedThroughputSettings": { | ||
"ReadCapacityAutoScalingSettings": { | ||
"MaxCapacity": 25, | ||
"MinCapacity": 5, | ||
"TargetTrackingScalingPolicyConfiguration": { | ||
"TargetValue": 70 | ||
} | ||
} | ||
}, | ||
"Region": "us-east-2", | ||
"TableClass": "STANDARD_INFREQUENT_ACCESS" | ||
}, | ||
{ | ||
"ContributorInsightsSpecification": { | ||
"Enabled": false | ||
}, | ||
"GlobalSecondaryIndexes": [ | ||
{ | ||
"IndexName": "gsi1", | ||
"ReadProvisionedThroughputSettings": { | ||
"ReadCapacityUnits": 15 | ||
} | ||
}, | ||
{ | ||
"ContributorInsightsSpecification": { | ||
"Enabled": true | ||
}, | ||
"IndexName": "gsi2", | ||
"ReadProvisionedThroughputSettings": { | ||
"ReadCapacityUnits": 10 | ||
} | ||
} | ||
], | ||
"PointInTimeRecoverySpecification": { | ||
"PointInTimeRecoveryEnabled": true | ||
}, | ||
"ReadProvisionedThroughputSettings": { | ||
"ReadCapacityUnits": 10 | ||
}, | ||
"Region": "us-west-2", | ||
"TableClass": "STANDARD" | ||
}, | ||
{ | ||
"ContributorInsightsSpecification": { | ||
"Enabled": true | ||
}, | ||
"GlobalSecondaryIndexes": [ | ||
{ | ||
"ContributorInsightsSpecification": { | ||
"Enabled": true | ||
}, | ||
"IndexName": "gsi1", | ||
"ReadProvisionedThroughputSettings": { | ||
"ReadCapacityUnits": 10 | ||
} | ||
}, | ||
{ | ||
"ContributorInsightsSpecification": { | ||
"Enabled": true | ||
}, | ||
"IndexName": "gsi2", | ||
"ReadProvisionedThroughputSettings": { | ||
"ReadCapacityUnits": 10 | ||
} | ||
} | ||
], | ||
"KinesisStreamSpecification": { | ||
"StreamArn": { | ||
"Fn::GetAtt": [ | ||
"Stream790BDEE4", | ||
"Arn" | ||
] | ||
} | ||
}, | ||
"PointInTimeRecoverySpecification": { | ||
"PointInTimeRecoveryEnabled": true | ||
}, | ||
"ReadProvisionedThroughputSettings": { | ||
"ReadCapacityUnits": 10 | ||
}, | ||
"Region": "us-east-1", | ||
"TableClass": "STANDARD_INFREQUENT_ACCESS" | ||
} | ||
], | ||
"SSESpecification": { | ||
"SSEEnabled": true, | ||
"SSEType": "KMS" | ||
}, | ||
"StreamSpecification": { | ||
"StreamViewType": "NEW_AND_OLD_IMAGES" | ||
}, | ||
"TableName": "my-global-table", | ||
"TimeToLiveSpecification": { | ||
"AttributeName": "attr", | ||
"Enabled": true | ||
}, | ||
"WriteProvisionedThroughputSettings": { | ||
"WriteCapacityAutoScalingSettings": { | ||
"MaxCapacity": 20, | ||
"MinCapacity": 1, | ||
"TargetTrackingScalingPolicyConfiguration": { | ||
"TargetValue": 60 | ||
} | ||
} | ||
} | ||
}, | ||
"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<String>", | ||
"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." | ||
} | ||
] | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...e-v2-global.js.snapshot/awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.assets.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"version": "34.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": {} | ||
} |
36 changes: 36 additions & 0 deletions
36
...v2-global.js.snapshot/awscdkglobaltableintegDefaultTestDeployAssertA2A9E81F.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"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." | ||
} | ||
] | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-global.js.snapshot/cdk.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":"34.0.0"} |
Oops, something went wrong.