One challenge when developing and testing code locally before you deploy is how you test against resources that are provisioned in the cloud. You can point directly to your cloud resources, but in some cases it’s easier if you can run and test code locally before you deploy.
DynamoDB has a local runtime that you can download and run locally from here.
Once downloaded run with:
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
You can use the AWS CLI to execute any of the DynamoDB commands against your local db by passing the –endpoint-url option like this:
aws dynamodb list-tables --endpoint-url http://localhost:8000
Docs for the available DynamoDB commands are here.
Other useful cli commands (append–endpoint-url http://localhost:8000 to use the local db):
List all tables:
aws dynamodb list-tables
Delete a table:
aws dynamodb delete-table --table-name tablename
Scan a table (with no criteria)
aws dynamodb scan --table-name tablename