Aws-cli: Can any one help me to create a DynamoDB Table with Local Secondary index using AWS cli?

Created on 16 Jun 2016  路  3Comments  路  Source: aws/aws-cli

guidance service-api

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}'

All 3 comments

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}'

Was this page helpful?
0 / 5 - 0 ratings