gpt4 book ai didi

amazon-web-services - AWS DynamoDB Local 使用 awscli 添加全局二级索引

转载 作者:行者123 更新时间:2023-12-02 16:30:30 26 4
gpt4 key购买 nike

您好,我尝试执行以下命令以将全局二级索引添加到现有表中:

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/模拟我的数据库。

An error occurred (InternalFailure) when calling the UpdateTableoperation (reached max retries: 9): The request processing has failedbecause of an unknown error, exception or failure.

最佳答案

参数 --global-secondary-index-updates 应该是一个有效的 JSON 字符串,但您的情况并非如此。它还缺少强制性 key 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/

关于amazon-web-services - AWS DynamoDB Local 使用 awscli 添加全局二级索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63565400/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com