ZedZip
ZedZip

Reputation: 6470

How to create table in the local Dynamodb?

I work in Windows 10. I run the docker aaronshaf/dynamodb-admin, ok. It contains DynamoDb and web ui. My goal is: to create c# application which works with dynamodb. How can I create a table in the Dynamodb via web ui? Or via c# application?

Upvotes: 0

Views: 1305

Answers (1)

Hee Su Chang
Hee Su Chang

Reputation: 116

I'm not familiar with aaronshaf/dynamodb-admin, but I've been able to set up dynamodb-local to work very well for the entire dev/test lifecycle.

  1. In the terminal run docker run -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb -inMemory to run dynamodb-local image on localhost:8000
  2. Run any command you need via aws-cli but specify the local endpoint. Ex.
aws dynamodb create-table \
    --table-name YourTableName \
    --attribute-definitions \
        AttributeName=YourPK,AttributeType=S \
        AttributeName=YourSK,AttributeType=S \
    --key-schema AttributeName=YourPK,KeyType=HASH AttributeName=YourSK,KeyType=RANGE \
    --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 \
    --endpoint-url http://localhost:8000
  1. To run your app locally with DynamoDb-Local, configure your DynamoDB SDK client's endpoint to http://localhost:8000.

Upvotes: 2

Related Questions