JSPM

@aws-cdk/aws-dynamodb

0.11.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 36316
  • Score
    100M100P100Q22738F
  • License Apache-2.0

CDK Constructs for AWS DynamoDB

Package Exports

  • @aws-cdk/aws-dynamodb

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@aws-cdk/aws-dynamodb) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

AWS DynamoDB Construct Library

Add a DynamoDB table to your stack like so:

import dynamodb = require('@aws-cdk/aws-dynamodb');

const defaultTable = new dynamodb.Table(stack, 'TableName');

const customTable = new dynamodb.Table(stack, 'CustomTable', {
    readCapacity: readUnits, // Default is 5
    writeCapacity: writeUnits, // Default is 5
    tableName: 'MyTableName' // Default is CloudFormation-generated, which is the preferred approach
})

Setup Auto Scaling for DynamoDB Table

further reading: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/AutoScaling.html https://aws.amazon.com/blogs/database/how-to-use-aws-cloudformation-to-configure-auto-scaling-for-amazon-dynamodb-tables-and-indexes/

Setup via Constructor

import dynamodb = require('@aws-cdk/aws-dynamodb');

const customTable = new dynamodb.Table(stack, 'CustomTable', {
    readCapacity: readUnits, // Default is 5
    writeCapacity: writeUnits, // Default is 5
    tableName: 'MyTableName', // Default is CloudFormation-generated, which is the preferred approach
    readAutoScaling: {
        minCapacity: 500,
        maxCapacity: 5000,
        targetValue: 75.0,
        scaleInCooldown: 30,
        scaleOutCooldown: 30,
        scalingPolicyName: 'MyAwesomeReadPolicyName'
    },
    writeAutoScaling: {
        minCapacity: 50,
        maxCapacity: 500,
        targetValue: 50.0,
        scaleInCooldown: 10,
        scaleOutCooldown: 10,
        scalingPolicyName: 'MyAwesomeWritePolicyName'
    },
});

Setup via addAutoScaling

import dynamodb = require('@aws-cdk/aws-dynamodb');

const customTable = new dynamodb.Table(stack, 'CustomTable', {
    readCapacity: readUnits, // Default is 5
    writeCapacity: writeUnits, // Default is 5
    tableName: 'MyTableName' // Default is CloudFormation-generated, which is the preferred approach
});
table.addReadAutoScaling({
    minCapacity: 500,
    maxCapacity: 5000,
    targetValue: 75.0,
    scaleInCooldown: 30,
    scaleOutCooldown: 30,
    scalingPolicyName: 'MyAwesomeReadPolicyName'
});
table.addWriteAutoScaling({
    minCapacity: 50,
    maxCapacity: 500,
    targetValue: 50.0,
    scaleInCooldown: 10,
    scaleOutCooldown: 10,
    scalingPolicyName: 'MyAwesomeWritePolicyName'
});