我正在创建一个包含本地二级索引的dynamoDB表。如果我在下面的语句中运行,它可以正常工作。
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={ProjectionType=ALL}'
但是,如果我尝试使用以下语句添加其他属性:
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=idx1,
KeySchema=[{AttributeName=Id,KeyType=HASH},{AttributeName=Name,KeyType=RANGE}],
Projection={ProjectionType=ALL}'
我收到以下错误消息:
when calling the CreateTable operation: One or more parameter values
were invalid: Some AttributeDefinitions are not used.
AttributeDefinitions: [Id, Name, Gender], keys used: [Id, Name]
有关如何解决问题的任何建议。