Here is a quick post to show how to run DynamoDB locally if you want to test without connecting to the Cloud. As I already mentioned in a previous blog post, it stores the DynamoDB table items in a SQLite database. Yes, a NoSQL database stored in a SQL one… this tells a lot about the power of SQL.
I’ll run DynamoDB Local in a Docker container, and define aliases to access it with AWS CLI and SQLite:
# Start DynamoDB local with a SQLite file (not in memory)
docker run --rm -d --name dynamodb -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb -dbPath /home/dynamodblocal
# alias to run `sqlite3` on this file
alias sql='docker exec -it dynamodb \
sqlite3 /home/dynamodblocal/shared-local-instance.db \
'
# alias to run AWS CLI with linked to the DynamoDB entrypoint and exposing the current directory as /aws (which is the container home directory)
alias aws='docker run --rm -it --link dynamodb:dynamodb -v $PWD:/aws \
-e AWS_DEFAULT_REGION=xx -e...