Skip to content

Latest commit

 

History

History
152 lines (129 loc) · 5.71 KB

DynamoDB_Tables.md

File metadata and controls

152 lines (129 loc) · 5.71 KB

DynamoDB Tables

This broker provides AWS DynamoDB Tables. The configuration key "dynamoDBTables" takes a list of DynamoDBTable definition objects which currently supports the following fields:

DynamoDBTable Definition

Name Type Required Description
tableName String YES Name of provisioned table
attributes List<AttributeDefinition> YES Attributes that define the key schema for the table
globalSecondaryIndexes List<GlobalSecondaryIndex> NO Global secondary indexes to be created on the table (Max 5)
keySchema List<KeySchemaElement> YES Specifies attribute that make up the table's primary key
localSecondaryIndexes List<LocalSecondaryIndex> NO Local secondary indexes to be created on the table
provisionedThroughput ProvisionedThroughput YES ReadCapacityUnits and WriteCapacityUnits provisioned for the table
sseSpecification SSESpecification NO Specifies server-side encryption. Default = Unencrypted
streamSpecification StreamSpecification NO Settings for DyanmoDB Table stream, used to capture changes made to the table

Creating Table

Tables create with the name "<appName>-<tableName>". So an app will have different table names for each environment. For example, a service call "some-service" with a table specified as "the-table" with environments "non-prod" and "prod", the table will be called "some-service-nonprod-the-table" and "some-service-prod-the-table". 

An IAM policy is also created for the table which restricts access to the deploying service and grants all authorities on the table.

Updating Table

DyanmoDB is limited in what can be edited post creation. Local Secondary Indexes can only be created when the table is created and is not editable.

Editable properties:

  • Attributes
  • Global Indexes
  • Provision Throughput
  • Stream Specification

Deleting Table

The broker does not support automatically deleting a table to prevent accidental data loss. Deletion of the table needs to be done through the console (or CLI). Also remember to delete the IAM policy created for the table. 

Missing Features

  • Table backups are not configured by the broker
  • Auto scaling
  • Global Tables
  • Triggers

Manifest Example

template.json

"dynamoDBTables": [
    {
      "tableName": "count-table",
      "attributes" : [
        {
          "attributeName": "topic",
          "attributeType": "S"
        },
        {
          "attributeName": "position",
          "attributeType": "N"
        },
        {
          "attributeName": "time",
          "attributeType": "N"
        }
      ],
      "keySchema": [
        {
          "attributeName": "topic",
          "keyType": "HASH"
        },
        {
          "attributeName": "position",
          "keyType": "RANGE"
        }
      ],
      "localSecondaryIndexes": [
        {
          "indexName": "timeIndex",
          "keySchema": [
            {
              "attributeName": "topic",
              "keyType": "HASH"
            },
            {
              "attributeName": "time",
              "keyType": "RANGE"
            }
          ],
          "projection": {
            "projectionType": "KEYS_ONLY"
          }
        }
      ],
      "provisionedThroughput": {
        "readCapacityUnits": 5,
        "writeCapacityUnits": 2
      },
      "sseSpecification": {
        "enabled": true
      },
      "streamSpecification": {
        "streamEnabled": true,
        "streamViewType": "NEW_IMAGE"
      },
      "tableName": "event-table"
    },
    {
      "attributes": [
        {
          "attributeName": "topic",
          "attributeType": "S"
        }
      ],
      "keySchema": [
        {
          "attributeName": "topic",
          "keyType": "HASH"
        }
      ],
      "provisionedThroughput": {
        "readCapacityUnits": 2,
        "writeCapacityUnits": 2
      },
      "sseSpecification": {
        "enabled": true
      },
      "streamSpecification": {
        "streamEnabled": false
      }
    }