DDB
A Command Line tool for easily interacting with DynamoDB
Usage
Install:
go get -u github.com/patrobinson/ddb
Get the contents of an item where foo=bar. Quotes are optional for strings:
ddb -table test -command get -statement 'foo="bar"'
Create an Item with string and number types:
ddb -table books -command set -statement 'book="1984",author="George Orwell",isbn=9780143566496'
Bool types:
ddb -table books -command set -statement 'book="1984",bestseller=true'
String sets:
ddb -table authors -command set -statement 'author="George Orwell",books=("1984","Animal Farm")'
Number sets:
ddb -table authors -command set -statement 'author="George Orwell",isbns=(9780143566496,9780141036144,9780241341667)'
List:
ddb -table cricketers -command set -statement 'name="Sir Donald Bradman",testscores=[18,1,79,112,40,58,123,37]'
Map:
ddb -table cricketers -command set -statement 'country="Australia",players=`{"Tim Paine":{"Batting Avg": 34.78}}`'
Binary, loaded from a file:
ddb -table cricketers -command set -statement 'country="Australia",players={"players.gz"}'
Binary Set:
ddb -table cricketers -command set -statement 'country="Australia",players=({"players1.gz"},{"players2.gz"})'
Development Status
I consider this software to be "feature complete" so adding new features is unlikely, unless DynamoDB supports new data types.
Bug reports and other inquiries though are welcome.
Supported Datatypes
- String
- Number
- Bool
- Number Set
- String Set
- List
- Map
- Binary Set
- Binary
Local development
docker run -d --rm -p 8000:8000 amazon/dynamodb-local
aws dynamodb --endpoint-url http://localhost:8000 create-table --table-name test --attribute-definitions AttributeName=foo,AttributeType=S --key-schema AttributeName=foo,KeyType=HASH --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1
go run main.go -endpoint http://localhost:8000 -table test -command set -statement 'foo="bar"'
go run main.go -endpoint http://localhost:8000 -table test -command get -statement 'foo="bar"'