DynamoDB Local Cheat Sheet

Official Link

  • Run a local version of DynamoDB in docker
  • Available as JAR or Docker image

CLI Usage

  • Use --endpoint-url with AWS CLI to test against the local database
aws dynamodb get-item \
    --endpoint-url http://localhost:8800 \
    --table-name myTable \
    --key '{ "uri": { "S": "aaaa" } }'
  • Local tables only support Provisioned Capacity, add --provisioned-throughput=ReadCapacityUnits=1,WriteCapacityUnits=1 to the aws dynamodb create-table command otherwise there will be error

Docker command

docker run -p 8800:8000 amazon/dynamodb-local \
    -jar DynamoDBLocal.jar \
    -inMemory \
  • -inMemory = Store data in memory, data is gone when container stops, good for testing
  • -sharedDb = No matter when account you use to access DynamoDB Local endpoint, you see the same pool of tables; otherwise every account gets its own tables; good for testing from both CLI and your application
  • Add --network local-dev --network-alias=dynamodb then other docker applications in the same network can access DynamoDB Local endpoint using http://dynamodb:8800

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s