Skip to content

Instantly share code, notes, and snippets.

@ChristianRich
Last active December 20, 2018 22:50
Show Gist options
  • Save ChristianRich/28402d41a28c9ed2e52be1c731a112d2 to your computer and use it in GitHub Desktop.
Save ChristianRich/28402d41a28c9ed2e52be1c731a112d2 to your computer and use it in GitHub Desktop.
AWS create DynamoDB tables on localhost
cd ~/dynamodb_local_latest
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
aws dynamodb create-table \
--endpoint-url http://localhost:8000 \
--table-name pricing-api-tst-menu-dyn \
--attribute-definitions \
AttributeName=id,AttributeType=S \
AttributeName=storeId,AttributeType=S \
--key-schema \
AttributeName=id,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=10 \
--global-secondary-indexes \
IndexName=store-index,KeySchema=["{AttributeName=storeId,KeyType=HASH}"],Projection="{ProjectionType=ALL}",ProvisionedThroughput="{ReadCapacityUnits=10,WriteCapacityUnits=10}"
aws dynamodb create-table \
--endpoint-url http://localhost:8000 \
--table-name customer-tst-customers-dyn \
--attribute-definitions \
AttributeName=id,AttributeType=S \
--key-schema \
AttributeName=id,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=10 \
aws dynamodb create-table \
--endpoint-url http://localhost:8000 \
--table-name customer-tst-customer-attributes-dyn \
--attribute-definitions \
AttributeName=id,AttributeType=S \
AttributeName=value,AttributeType=S \
AttributeName=valueHash,AttributeType=S \
AttributeName=customerId,AttributeType=S \
--key-schema \
AttributeName=id,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=10 \
--global-secondary-indexes \
IndexName=value-index,KeySchema=["{AttributeName=value,KeyType=HASH}"],Projection="{ProjectionType=ALL}",ProvisionedThroughput="{ReadCapacityUnits=10,WriteCapacityUnits=10}" \
IndexName=valueHash-index,KeySchema=["{AttributeName=valueHash,KeyType=HASH}"],Projection="{ProjectionType=ALL}",ProvisionedThroughput="{ReadCapacityUnits=10,WriteCapacityUnits=10}" \
IndexName=customer-index,KeySchema=["{AttributeName=customerId,KeyType=HASH}"],Projection="{ProjectionType=ALL}",ProvisionedThroughput="{ReadCapacityUnits=10,WriteCapacityUnits=10}"
aws dynamodb create-table \
--endpoint-url http://localhost:8000 \
--table-name payments-api-tst-payments-dyn \
--attribute-definitions \
AttributeName=id,AttributeType=S \
AttributeName=referenceId,AttributeType=S \
--key-schema \
AttributeName=id,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=10 \
--global-secondary-indexes \
IndexName=reference-index,KeySchema=["{AttributeName=referenceId,KeyType=HASH}"],Projection="{ProjectionType=ALL}",ProvisionedThroughput="{ReadCapacityUnits=10,WriteCapacityUnits=10}"
aws dynamodb create-table \
--endpoint-url http://localhost:8000 \
--table-name order-tst-order-dyn \
--attribute-definitions \
AttributeName=id,AttributeType=S \
AttributeName=status,AttributeType=S \
--key-schema \
AttributeName=id,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=10 \
--global-secondary-indexes \
IndexName=status-index,KeySchema=["{AttributeName=status,KeyType=HASH}"],Projection="{ProjectionType=ALL}",ProvisionedThroughput="{ReadCapacityUnits=10,WriteCapacityUnits=10}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment