UpdateTable operation with the GlobalSecondaryIndexUpdates parameter 1

UpdateTable operation with the GlobalSecondaryIndexUpdates parameter

aws dynamodb update-table \
    --region eu-west-1 \
    --endpoint-url http://127.0.0.1:8000 \
    --table-name ssib_dev_assetsTable \
    --attribute-definitions AttributeName=AssetGroup,AttributeType=S \
    --global-secondary-index-updates '[{"Create":{"IndexName":"gsi_group","KeySchema":[{"AttributeName":"AssetGroup","KeyType":"HASH"}],"Projection":{"ProjectionType":"ALL"},"ProvisionedThroughput":{"ReadCapacityUnits":5,"WriteCapacityUnits":5}}}]'

By the way, you should probably use the official image instead of some image by some random user docker user: https://hub.docker.com/r/amazon/dynamodb-local/

Here is what the above code is Doing:
1. Create a table with a primary key of AssetId
2. Create a global secondary index with a primary key of AssetGroup
3. Update the table to add a global secondary index with a primary key of AssetGroup

Similar Posts