Skip to content

twentyfourg/dynamodb-local

Repository files navigation

DynamoDB Local DynamoDB Local Docker Pulls

DynamoDB Local

Run DynamoDB locally inside a Docker container.

The container comes shipped with DynamoDB-local and DynamoDB Admin for easy GUI access. You can also set default table(s) to be created on start up.

Usage

docker run -d -p 8000:8000 -p 8001:8001 twentyfourg/dynamodb-local

Configuration

You can enable/disable features or change configuration by using environment variables.

Environment Variable Description Default
DYNAMODB_ADMIN_ENABLED Enable or disable DynamoDB Admin true
DYNAMODB_CREATE_TABLES Whether to create default DynamoDB tables true
DYNAMODB_TABLE_SCHEMA_PATH Where the DynamoDB table schema JSON is stored. Only does something if DYNAMODB_CREATE_TABLES is set. ./tableSchema.json

Default Tables

Default tables are created using a JSON schema. You can define custom tables to create by mounting a schema file into the container and altering the DYNAMODB_TABLE_SCHEMA_PATH environment variable.

The schema file must be a JSON array so even if you have one table, enclose your table in [].

One Table

[
  {
    "TableName": "cache",
    "KeySchema": [{ "AttributeName": "key", "KeyType": "HASH" }],
    "AttributeDefinitions": [{ "AttributeName": "key", "AttributeType": "S" }],
    "BillingMode": "PAY_PER_REQUEST"
  }
]

Multiple Tables

[
  {
    "TableName": "cache",
    "KeySchema": [{ "AttributeName": "key", "KeyType": "HASH" }],
    "AttributeDefinitions": [{ "AttributeName": "key", "AttributeType": "S" }],
    "BillingMode": "PAY_PER_REQUEST"
  },
  {
    "TableName": "rate-limit",
    "KeySchema": [{ "AttributeName": "key", "KeyType": "HASH" }],
    "AttributeDefinitions": [{ "AttributeName": "key", "AttributeType": "S" }],
    "BillingMode": "PAY_PER_REQUEST"
  }
]