Aws-cli: 任何人都可以帮助我使用 AWS cli 创建带有本地二级索引的 DynamoDB 表吗?

创建于 2016-06-16  ·  3评论  ·  资料来源: aws/aws-cli

guidance service-api

最有用的评论

aws dynamodb create-table --table-name XYZ --attribute-definitions AttributeName=Id,AttributeType=N AttributeName=Name,AttributeType=S --key-schema AttributeName=Id,KeyType=HASH AttributeName=Name,KeyType=RANGE - -provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --local-secondary-indexes 'IndexName=idx1,KeySchema=[{AttributeName=Id,KeyType=HASH},{AttributeName=Name,KeyType=RANGE}],Projection={投影类型=ALL}'

所有3条评论

对于 LSI,您将在create-table调用中使用--local-secondary-indexes 'IndexName=string,KeySchema=[{AttributeName=string,KeyType=string},{AttributeName=string,KeyType=string}],Projection={ProjectionType=string,NonKeyAttributes=[string,string]}'

如果您仍有问题,请到我们的 gitter 室与我们聊天。 关闭支持 gitter。

嗨詹姆士,

aws dynamodb create-table --table-name XYZ --attribute-definitions AttributeName=Id,AttributeType=N AttributeName=Name,AttributeType=S AttributeName=Gender,AttributeType=S --key-schema AttributeName=Id,KeyType=HASH AttributeName =Name,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --local-secondary-indexes 'IndexName=string,KeySchema=[{AttributeName=Gender,KeyType=RANGE},{AttributName=Id,KeyType= HASH}],Projection={ProjectionType=ALL}'

我已经使用上面的代码创建了一个表。 但我收到错误:

_错误解析参数'--local-secondary-indexes':预期:'=',收到:''
' 用于输入:
'IndexName=string,KeySchema=[{AttributeName=Gender,KeyType=RANGE},{AttributName=
Id,KeyType=HASH}],Projection={ProjectionType=ALL}'_

谢谢您的支持

aws dynamodb create-table --table-name XYZ --attribute-definitions AttributeName=Id,AttributeType=N AttributeName=Name,AttributeType=S --key-schema AttributeName=Id,KeyType=HASH AttributeName=Name,KeyType=RANGE - -provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --local-secondary-indexes 'IndexName=idx1,KeySchema=[{AttributeName=Id,KeyType=HASH},{AttributeName=Name,KeyType=RANGE}],Projection={投影类型=ALL}'

此页面是否有帮助?
0 / 5 - 0 等级