DynamoDB

Get started with Amazon DynamoDB on LocalStack

DynamoDB on LocalStack is powered by DynamoDB Local.

Global tables

LocalStack has support for global tables (version 2019). These are tables belonging to the same account and replicated across different regions.

Following example illustrates the use of global tables:

# Create a table
$ awslocal dynamodb create-table \
    --table-name global01 \
    --key-schema AttributeName=id,KeyType=HASH \
    --attribute-definitions AttributeName=id,AttributeType=S \
    --billing-mode PAY_PER_REQUEST \
    --region ap-south-1
# Create replicas
$ awslocal dynamodb update-table \
    --table-name global01 \
    --replica-updates '[{"Create": {"RegionName": "eu-central-1"}}, {"Create": {"RegionName": "us-west-1"}}]' \
    --region ap-south-1
# Table can be operated on in all replicated regions
$ awslocal dynamodb list-tables --region eu-central-1
{
    "TableNames": [
        "global01"
    ]
}

$ awslocal dynamodb put-item --table-name global01 --item '{"id":{"S":"foo"}} --region eu-central-1

$ awslocal dynamodb describe-table --table-name global01 --query 'Table.ItemCount' --region ap-south-1
1
$ awslocal dynamodb describe-table --table-name global01 --query 'Table.Replicas' --region us-west-1
[
    {
        "RegionName": "ap-south-1",
        "ReplicaStatus": "ACTIVE"
    },
    {
        "RegionName": "eu-central-1",
        "ReplicaStatus": "ACTIVE"
    },
    {
        "RegionName": "us-west-1",
        "ReplicaStatus": "ACTIVE"
    }
]

Last modified January 11, 2023: Add DynamoDB docs (#400) (b911c332)