These are chat archives for aws/aws-cli

24th
May 2017
ppremk
@ppremk
May 24 2017 06:37

hi all, i am learning dynamodb and following the example from the documentation of aws. Stuck at this section where I need to create a global index for the reply table. The following syntax throws the error

'Error parsing parameter '--global-secondary-indexes': Expected: ',', received: '}' for input:'

the following is the complete code sample for the aws CLI:

aws dynamodb create-table \
--table-name \
Reply \
--attribute-definitions \
AttributeName=Id,AttributeType=S \
AttributeName=ReplyDateTime,AttributeType=S \
AttributeName=PostedBy,AttributeType=S \
AttributeName=Message,AttributeType=S \
--key-schema \
AttributeName=Id,KeyType=HASH \
AttributeName=ReplyDateTime,KeyType=RANGE \
--global-secondary-indexes \
IndexName=PostedBy-Message-Index,KeySchema=["{AttributeName=PostedBy,KeyType=HASH}","{AttributeName=Message,KeyType=RANGE}"],Projection="{ProjectionType=ALL,NonKeyAttributes=["key"]}}",ProvisionedThroughput="{ReadCapacityUnits=1,WriteCapacityUnits=1}" \
--provisioned-throughput \
ReadCapacityUnits=1,WriteCapacityUnits=1 \
--endpoint-url \
http://localhost:8000

hope someone could help point out where i am going wrong :)

Kacper Skory
@kskory
May 24 2017 07:49
@ppremk "{ProjectionType=ALL,NonKeyAttributes=["key"]}}"
you've got }} here instead of }.
Also the quoting looks weird, I think you don't have to use " in shorthand syntax
ppremk
@ppremk
May 24 2017 08:35
@kskory thank you for pointing out. I am going to try it out now