I am creating a dynamoDB table with local secondary indexes. If I run below statement, it works fine.
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}'
However, if I try to add additional attribute by using this below statement:
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}'
I receive below error message:
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]
Any advise on how to resolve it.