Wednesday 13 January 2016

DynamoDB cheat sheet

https://docs.aws.amazon.com/cli/latest/reference/dynamodb/index.html#cli-aws-dynamodb





# Write to the DynamoDB table
for serialno in {1..2000}
do
aws dynamodb put-item --table-name zorantest --region ap-southeast-2 --item '{ "serial" : {"N":"'$serialno'"}, "text1" : {"S": "NeptuneioNeptuneioNeptuneioNeptuneioNeptuneioNeptuneioNeptuneioNeptuneioNeptuneioNeptuneio"}}' &
done

# Read from the DynamoDB table
for i in {1..1000}
do
  aws dynamodb scan --table-name zorantest --region ap-southeast-2 > /dev/null
  aws dynamodb get-item --table-name zorantest --key '{ "serial" : {"N" : "'$((RANDOM%2000))'"} }' --region ap-southeast-2 >/dev/null
  sleep 1
done

# List all DynamoDB tables
aws dynamodb list-tables | jq -r '.TableNames' | grep ' "' | tr ',' ' ' | cut -d'"' -f2

# Describe a DynamoDB table
aws dynamodb describe-table --table-name zorantest --region ap-southeast-2

DynamicDB can monitor the increase/decrease DynamoDB instance (via CloudWatch) and provision more throughput as needed: https://github.com/sebdah/dynamic-dynamodb

Simple PHP A Simple Web App On AWS With DynamoDB:
https://github.com/AccelNA/aws-coe/wiki/Building-A-Simple-Web-App-On-AWS-With-DynamoDB-and-S3

No comments:

Post a Comment