您好,我尝试执行以下命令,以便将全局辅助索引添加到现有表中:
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}}"
--provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=10
在+或-10秒后,我得到了以下响应,没有任何明确的错误消息。我使用https://hub.docker.com/r/cnadiminti/dynamodb-local/模仿我的数据库。
调用UpdateTable时发生错误(InternalFailure(操作(达到最大重试次数:9(:请求处理失败由于未知错误、异常或失败。
参数--global-secondary-index-updates
应该是一个有效的JSON字符串,但在您的情况下不是这样。它还缺少一个强制密钥ProvisionedThroughput
。
https://docs.aws.amazon.com/cli/latest/reference/dynamodb/update-table.html
如下:
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/