For an LSI, you would use --local-secondary-indexes 'IndexName=string,KeySchema=[{AttributeName=string,KeyType=string},{AttributeName=string,KeyType=string}],Projection={ProjectionType=string,NonKeyAttributes=[string,string]}'
in your create-table
call.
If you're still having issues, come chat with us over in our gitter room. Closing in favor of gitter.
Hi Jamesls,
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}'
i have used the above code to create a table. But i am getting the error:
_Error parsing parameter '--local-secondary-indexes': Expected: '=', received: ''
' for input:
'IndexName=string,KeySchema=[{AttributeName=Gender,KeyType=RANGE},{AttributName=
Id,KeyType=HASH}],Projection={ProjectionType=ALL}'_
Thanks for your support
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}'
Most helpful comment
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}'