cfn-modules: AWS DynamoDB table

August 8, 2020 ยท View on GitHub

AWS DynamoDB table with auto scaling and alerting.

Install

Install Node.js and npm first!

npm i @cfn-modules/dynamodb-table

Usage

---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'cfn-modules example'
Resources:
  Table:
    Type: 'AWS::CloudFormation::Stack'
    Properties:
      Parameters:
        AlertingModule: !GetAtt 'Alerting.Outputs.StackName' # optional
        KmsKeyModule: !GetAtt 'Key.Outputs.StackName' # optional
        TableName: user # optional
        PartitionKeyName: id # optional
        PartitionKeyType: S # optional
        SortKeyName: '' # optional
        SortKeyType: N # optional
        BillingAndScalingMode: PROVISIONED # optional
        MaxWriteCapacityUnits: '1' # optional
        MinWriteCapacityUnits: '1' # optional
        WriteCapacityUnitsUtilizationTarget: '80' # optional
        MaxReadCapacityUnits: '1' # optional
        MinReadCapacityUnits: '1' # optional
        ReadCapacityUnitsUtilizationTarget: '80' # optional
        Encryption: 'false' # optional; deprecated in v1, will be removed in v3, use KmsKeyModule instead!
        StreamViewType: DISABLED # optional
        TtlAttributeName: '' # optional
        BackupRetentionPeriod: '30' # optional
        BackupScheduleExpression: 'cron(0 5 ? * * *)' # optional
        PointInTimeRecoveryEnabled: 'true' # optional
      TemplateURL: './node_modules/@cfn-modules/dynamodb-table/module.yml'

Examples

Parameters

Name Description Default Required? Allowed values
AlertingModule Stack name of alerting module no
KmsKeyModule Stack name of kms-key module no
TableName Name of the table auto generated value no
PartitionKeyName Name of the partition key id no
PartitionKeyType Type of the partition key S no [S, N, B]
SortKeyName Name of the sort key no
SortKeyType Type of the sort key (if SortKeyName is set) N no [S, N, B]
BillingAndScalingMode Specify how you are charged for read and write throughput and how you manage capacity. PROVISIONED no [PROVISIONED, ONDEMAND]
MaxWriteCapacityUnits Maximum write capacity units used during auto scaling 1 no
MinWriteCapacityUnits Minimum write capacity units used during auto scaling 1 no
WriteCapacityUnitsUtilizationTarget Target write capacity utilization (in percent) that auto scaling tries to achieve (if you have spiky writes, a lower number is better) 80 no
MaxReadCapacityUnits Maximum read capacity units used during auto scaling 1 no
MinReadCapacityUnits Minimum read capacity units used during auto scaling 1 no
ReadCapacityUnitsUtilizationTarget Target read capacity utilization (in percent) that auto scaling tries to achieve (if you have spiky reads, a lower number is better) 80 no
Encryption Deprecated in v1, will be removed in v3, use KmsKeyModule instead! Enable server side encryption using KMS (AWS managed) CMK false no [aws, false]
StreamViewType Determines the information that the stream captures when an item in the table is modified DISABLED no [DISABLED, KEYS_ONLY, NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGES]
TtlAttributeName Name of the TTL attribute that stores the expiration time for items in the table. The name can be 1โ€“255 characters long, and has no character restrictions. (TTL is disabled if not set) no
BackupRetentionPeriod The number of days to keep backups of the table (set to 0 to disable) 30 no [0-35]
BackupScheduleExpression A CRON expression specifying when AWS Backup initiates a backup job cron(0 5 ? * * *) no
PointInTimeRecoveryEnabled Indicates whether point in time recovery is enabled (true) or disabled (false) on the table true no [true, false]