Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
dynamodb notes

Important note : Use " -sharedDb " flag whilde starting local dynamodb. otherwise js will use a different profile. And you can't access your tables what created from via cli or other platforms

$ wget
$ unzip ...
$ sudo pip install awscli
$ ./DynamoDbLocal.jar --port 8787

###Create table

$ aws dynamodb create-table  --table-name MusicCollection  --attribute-definitions  AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S --key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE  --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1  --endpoint=http://localhost:8787

##List Tables

$ aws dynamodb list-tables --endpoint-url http://localhost:8787

###Put item

$ aws dynamodb put-item  --table-name MusicCollection --item '{ "Artist": {"S": "No One You Know"}, "SongTitle": {"S": "Call Me Today"} , "AlbumTitle": {"S": "Somewhat Famous"} }' --return-consumed-capacity TOTAL --endpoint=http://localhost:8787

$ aws dynamodb put-item --table-name MusicCollection --item '{  "Artist": {"S": "Acme Band"},  "SongTitle": {"S": "Happy Day"} ,  "AlbumTitle": {"S": "Songs About Life"} }'  --return-consumed-capacity TOTAL  --endpoint=http://localhost:8787


$ aws dynamodb query --table-name MusicCollection --key-conditions file://key-conditions.json --endpoint=http://localhost:8787
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.