Amazon DynamoDB - Using the CLI
aws dynamodb create-table \ --table-name Music \ --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
aws dynamodb put-item \ --table-name Music \ --item \ '{"Artist": {"S": "No One You Know"}, "SongTitle": {"S": "Call Me Today"}, "AlbumTitle": {"S": "Somewhat Famous"}}' \ --return-consumed-capacity TOTAL aws dynamodb put-item \ --table-name Music \ --item '{ \ "Artist": {"S": "Acme Band"}, \ "SongTitle": {"S": "Happy Day"}, \ "AlbumTitle": {"S": "Songs About Life"} }' \ --return-consumed-capacity TOTAL
Working with python and dynamodb locally refer-
aws dynamodb put-item \ --table-name Music \ --item \ '{"Artist": {"S": "No One You Know"}, "SongTitle": {"S": "Call Me Today"}, "AlbumTitle": {"S": "Somewhat Famous"}}' \ --return-consumed-capacity TOTAL aws dynamodb put-item \ --table-name Music \ --item '{ \ "Artist": {"S": "Acme Band"}, \ "SongTitle": {"S": "Happy Day"}, \ "AlbumTitle": {"S": "Songs About Life"} }' \ --return-consumed-capacity TOTAL
consider the following JSON snippet, which is stored in a file named key-conditions.json:
{
"Artist": {
"AttributeValueList": [
{
"S": "No One You Know"
}
],
"ComparisonOperator": "EQ"
},
"SongTitle": {
"AttributeValueList": [
{
"S": "Call Me Today"
}
],
"ComparisonOperator": "EQ"
}
}
You can now issue a
Query
request using the AWS CLI. In this example, the contents of the key-conditions.json file are used for the --key-conditions
parameter:
aws dynamodb query --table-name Music --key-conditions file://key-conditions.json
Using the AWS CLI with Downloadable DynamoDB
aws dynamodb list-tables --endpoint-url http://localhost:8000
Run dbs locally -
Run dbs locally -
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
Working with python and dynamodb locally refer-
Comments
Post a Comment