https://github.com/awsdataarchitect/dynamdb-l1-construct-with-autoscaling
Example open-source repo for Scaling DynamoDB Capacity using AWS-CDK L1 Construct Library that does not natively support auto-scaling in CfnTable construct
https://github.com/awsdataarchitect/dynamdb-l1-construct-with-autoscaling
aws cdk cdk-construct-library cloudformation dynamodb
Last synced: 23 days ago
JSON representation
Example open-source repo for Scaling DynamoDB Capacity using AWS-CDK L1 Construct Library that does not natively support auto-scaling in CfnTable construct
- Host: GitHub
- URL: https://github.com/awsdataarchitect/dynamdb-l1-construct-with-autoscaling
- Owner: awsdataarchitect
- Created: 2024-05-01T04:06:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-01T04:31:54.000Z (about 2 years ago)
- Last Synced: 2025-12-25T21:23:19.397Z (6 months ago)
- Topics: aws, cdk, cdk-construct-library, cloudformation, dynamodb
- Language: TypeScript
- Homepage: https://vivek-aws.medium.com/scaling-dynamodb-capacity-using-aws-cdk-l1-construct-library-that-does-not-natively-support-cf3ace6d041d
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example open-source repo for Scaling DynamoDB Capacity using AWS-CDK L1 Construct Library that does not natively support auto-scaling in CfnTable construct
If you are using only L1 constructs in your application, then DynamoDB tables Level 1 construct (CfnTable), does not natively support auto-scaling for local table, so how does one implement the Autoscaling for provisioned read/writes ?
Note: CfnTable does however support Autoscaling for the Global Tables in CloudFormation templates
To understand the root cause, this is because the Level 1 construct `CfnTable` maps directly to the CloudFormation resource `AWS::DynamoDB::Table` and you can only define the resource's properties when using the Level 1 construct.
DynamoDB uses Application Autoscaling to automatically scale the table's capacity .
Thus, you would need to use the `CfnScalableTarget` & `CfnScalingPolicy` constructs of application autoscaling resource to enable autoscaling on DynamoDB.
This sample repo shows implementation using AWS CDK Application Auto Scaling L1 construct library for a DynamoDb resource.
For more details, refer to the [Blog Post](https://vivek-aws.medium.com/scaling-dynamodb-capacity-using-aws-cdk-l1-construct-library-that-does-not-natively-support-cf3ace6d041d).
The `cdk.json` file tells the CDK Toolkit how to execute your app.
## Useful commands
* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `npm run test` perform the jest unit tests
* `npx cdk deploy` deploy this stack to your default AWS account/region
* `npx cdk diff` compare deployed stack with current state
* `npx cdk synth` emits the synthesized CloudFormation template