Skip to content

Latest commit

 

History

History
47 lines (46 loc) · 1.5 KB

db-table.md

File metadata and controls

47 lines (46 loc) · 1.5 KB

todo

aws dynamodb create-table \
    --table-name todo \
    --attribute-definitions \
        AttributeName=id,AttributeType=S \
        AttributeName=date,AttributeType=S \
        AttributeName=userId,AttributeType=S \
    --key-schema \
        AttributeName=id,KeyType=HASH \
        AttributeName=date,KeyType=RANGE \
    --global-secondary-indexes \
        "[
            {
                \"IndexName\": \"userId-index\",
                \"KeySchema\": [{
                    \"AttributeName\": \"userId\",
                    \"KeyType\": \"HASH\"
                }],
                \"Projection\": {
                    \"ProjectionType\": \"ALL\"
                },
                \"ProvisionedThroughput\": {
                    \"ReadCapacityUnits\": 5,
                    \"WriteCapacityUnits\": 5
                }
            },
            {
                \"IndexName\": \"userId-date-index\",
                \"KeySchema\": [
                    {\"AttributeName\": \"userId\", \"KeyType\": \"HASH\"},
                    {\"AttributeName\": \"date\", \"KeyType\": \"RANGE\"}
                ],
                \"Projection\": {
                    \"ProjectionType\": \"ALL\"
                },
                \"ProvisionedThroughput\": {
                    \"ReadCapacityUnits\": 5,
                    \"WriteCapacityUnits\": 5
                }
            }
        ]" \
    --provisioned-throughput \
        ReadCapacityUnits=5,WriteCapacityUnits=5 \
    --endpoint-url http://localhost:8000