@aws-cdk/dynamodb

AWS DynamoDB Construct Library

Add a DynamoDB table to you stack like so:

import { Table } from '@aws-cdk/dynamodb';

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

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

Reference

KeyAttributeType (enum)

class _aws-cdk_dynamodb.KeyAttributeType
Binary
Number
String

Table

class _aws-cdk_dynamodb.Table(parent, name[, props])

Provides a DynamoDB table.

Extends:

Construct

Parameters:
  • parent (Construct) –
  • name (string) –
  • props (TableProps or None) –
addPartitionKey(name, type) → @aws-cdk/dynamodb.Table
Parameters:
  • name (string) –
  • type (KeyAttributeType) –
Return type:

Table

addSortKey(name, type) → @aws-cdk/dynamodb.Table
Parameters:
  • name (string) –
  • type (KeyAttributeType) –
Return type:

Table

validate() → string[]

This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.

Return type:string
tableArn
Type:TableArn (readonly)
tableName
Type:TableName (readonly)
tableStreamArn
Type:TableStreamArn (readonly)

TableName

class _aws-cdk_dynamodb.TableName([valueOrFunction])
Extends:Token
Parameters:valueOrFunction (any or None) –

TableProps (interface)

class _aws-cdk_dynamodb.TableProps
readCapacity

The read capacity for the table. Careful if you add Global Secondary Indexes, as those will share the table’s provisioned throughput.

Type:number or None
writeCapacity

The write capacity for the table. Careful if you add Global Secondary Indexes, as those will share the table’s provisioned throughput.

Type:number or None
tableName

Enforces a particular physical table name.

Type:string or None