Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamodb: FIXED capacity mode should be supported #27443

Closed
liusongdu opened this issue Oct 8, 2023 · 5 comments
Closed

dynamodb: FIXED capacity mode should be supported #27443

liusongdu opened this issue Oct 8, 2023 · 5 comments
Labels
@aws-cdk/aws-dynamodb Related to Amazon DynamoDB bug This issue is a bug. duplicate This issue is a duplicate.

Comments

@liusongdu
Copy link

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

@liusongdu liusongdu added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 8, 2023
@github-actions github-actions bot added the @aws-cdk/aws-dynamodb Related to Amazon DynamoDB label Oct 8, 2023
@liusongdu
Copy link
Author

liusongdu commented Oct 8, 2023

Below is a CloudFormation template to create DynamoDB table with WCU fixed:

cdk_dynamodb_wcu.txt

@khushail khushail added duplicate This issue is a duplicate. and removed needs-triage This issue or PR still needs to be triaged. labels Oct 9, 2023
@khushail
Copy link
Contributor

khushail commented Oct 9, 2023

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

@khushail khushail closed this as completed Oct 9, 2023
@github-actions
Copy link

github-actions bot commented Oct 9, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

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.

@liusongdu
Copy link
Author

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

@christophercurrie
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-dynamodb Related to Amazon DynamoDB bug This issue is a bug. duplicate This issue is a duplicate.
Projects
None yet
Development

No branches or pull requests

3 participants