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 GSI Autoscaling doesn't require a scaling policy, leading to invalid infrastructure configuration #7464

Open
Brusalk opened this issue Apr 20, 2020 · 3 comments
Labels
@aws-cdk/aws-dynamodb Related to Amazon DynamoDB bug This issue is a bug. ddb-legacy-table This issue has to do with DynamoDB's legacy Table construct. Close after migration guide is out. effort/medium Medium work item – several days of effort p2

Comments

@Brusalk
Copy link

Brusalk commented Apr 20, 2020

DynamoDB GSI Autoscaling doesn't require a scaling policy, leading to invalid infrastructure configuration

Background

When using GSI Autoscaling, it's possible to add autoscaling targets without adding an associated scaling policy.

 table.addGlobalSecondaryIndex({
    indexName: props.indexName,
    partitionKey: props.partitionKey,
    sortKey: props.sortKey,
  });
  table.autoScaleGlobalSecondaryIndexReadCapacity(props.indexName, {
    minCapacity: props.minReadCapacity,
    maxCapacity: props.maxReadCapacity,
  });
  table.autoScaleGlobalSecondaryIndexWriteCapacity(props.indexName, {
    minCapacity: props.minWriteCapacity,
    maxCapacity: props.maxWriteCapacity,
  });

When you do that, CDK (nor the underlying CloudFormation) error on the invalid configuration.

What's the impact

The end result is that DynamoDB results in failing to autoscale the GSI, resulting in the GSI only using the default levels, with the only notification to the customer being an "ERROR" field when looking at the GSI.

Currently, nothing prevents the customer from ending up with an invalid autoscaling configuration, that'll only get caught when they need autoscaling the most.

What should CDK do

In my opinion, CDK should fail the build because of the invalid autoscaling configuration on the GSI.

I imagine it'd be possible to detect whether no scaling policy was added for the GSI (either through the helpers, or manually through lower-level cloudformation resources)

Potential "gotchas" with the implementation

  • A customer could add the underlying scaling policy using the low-level resource types themselves.
@Brusalk Brusalk added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 20, 2020
@SomayaB SomayaB added the @aws-cdk/aws-dynamodb Related to Amazon DynamoDB label Apr 20, 2020
@RomainMuller RomainMuller added effort/medium Medium work item – several days of effort p2 and removed needs-triage This issue or PR still needs to be triaged. labels Aug 11, 2020
@SomayaB SomayaB assigned skinny85 and unassigned RomainMuller Aug 20, 2020
@github-actions
Copy link

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jun 17, 2022
@Brusalk
Copy link
Author

Brusalk commented Jun 17, 2022

Please keep this open

@github-actions github-actions bot removed the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jun 17, 2022
@rix0rrr
Copy link
Contributor

rix0rrr commented Sep 21, 2023

This issue was for the existing Table construct, which used custom resources to implement table replication. We no longer recommend the use of the Table construct.

Instead, the TableV2 construct has been released in 2.95.1 (#27023) which maps to the AWS::DynamoDB::GlobalTable resource, has better support for replication and does not suffer from the issue described here.


Be aware that there are additional deployment steps involved in a migration from Table to TableV2. You need to do a RETAIN deployment, a delete deployment, then change the code to use TableV2 and then use cdk import. A link to a full guide will be posted once it is available.

Here are some other resources to get you started (using CfnGlobalTable instead of TableV2) if you want to get going on the migration:

@rix0rrr rix0rrr added the ddb-legacy-table This issue has to do with DynamoDB's legacy Table construct. Close after migration guide is out. label Sep 21, 2023
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. ddb-legacy-table This issue has to do with DynamoDB's legacy Table construct. Close after migration guide is out. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

No branches or pull requests

5 participants