Closed liusongdu closed 11 months ago
Below is a CloudFormation template to create DynamoDB table with WCU fixed:
Hi @liusongdu , Here its described how the TableV2 construct can be configured with provisioned billing-
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:
const table = new dynamodb.TableV2(this, 'Table', {
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
billing: dynamodb.Billing.provisioned({
readCapacity: dynamodb.Capacity.fixed(10),
writeCapacity: dynamodb.Capacity.autoscaled({ maxCapacity: 15 }),
}),
});
what you have shared in the cloudformation template, that is in accordance with what is implemented by CDK. The provisionedThroughputDescription object accepts the value a stated.
So the feature requested by you is not do-able as its not supported by Cloudformation.
Past Similar request -https://github.com/aws/aws-cdk/issues/27378
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Setting fixed WCU, I do think it is supported by CloudFormation. The evidence is the attached CloudFormation template example. So my understand is that only CDK not support this, but CloudFormation does. @khushail
Hi @liusongdu , Here its described how the TableV2 construct can be configured with provisioned billing-
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:
const table = new dynamodb.TableV2(this, 'Table', { partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING }, billing: dynamodb.Billing.provisioned({ readCapacity: dynamodb.Capacity.fixed(10), writeCapacity: dynamodb.Capacity.autoscaled({ maxCapacity: 15 }), }), });
what you have shared in the cloudformation template, that is in accordance with what is implemented by CDK. The provisionedThroughputDescription object accepts the value a stated.
So the feature requested by you is not do-able as its not supported by Cloudformation.
Past Similar request -#27378
For everyone else coming here confused: TableV2
is built on top of the AWS::DynamoDB::GlobalTable
resource, not the AWS::DynamoDB::Table
resource. The GlobalTable resource does not support fixed write capacity, hence this construct cannot support it.
Describe the bug
Creating a TableV2 with provisioned billing fails if I specify fixed capacity for WCU.
Error: You cannot configure 'writeCapacity' with FIXED capacity mode
Using fixed capacity for DynamoDB table provision mode should be supported by CDK, as it is supported by CloudFormation.
CDK don't support configuring 'writeCapacity' with FIXED capacity mode, however, this is supported by CloudFormation. https://github.com/aws/aws-cdk/tree/main/packages/aws-cdk-lib/aws-dynamodb#billing https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html
Expected Behavior
My table's capacity is well known so I don't need the autoscaling. The FIXED write capacity mode should be supported by DynamoDB CDK.
Current Behavior
Currently, the write capacity field of the DynamoDB CDK only support autoscaling capacity.
Reproduction Steps
new TableV2(this, my-table, { billing: Billing.provisioned({ readCapacity: Capacity.fixed(3), writeCapacity: Capacity.fixed(1), }), }
Possible Solution
Support fixed capacity for WCU.
Additional Information/Context
No response
CDK CLI Version
2.100.0
Framework Version
No response
Node.js Version
v18.17.1
OS
Linux
Language
Python
Language Version
3.9.16
Other information
No response