Define StringSet AttributeType when creating DynamoDB table, via the AWS-CLI and with a JSON skeleton

Viewed 2174

I am trying to define a table for Amazon Web Service DynamoDB from the command line.

I have successfully run aws dynamodb create-table --cli-input-json file://tmp.json with the following json file:

  1 {
  2     "AttributeDefinitions": [
  3         {
  4             "AttributeName": "testCase",
  5             "AttributeType": "S"
  6         },
  7         {
  8             "AttributeName": "cFlags",
  9             "AttributeType": "S"
 10         }
 11     ],
 12     "TableName": "TestTable",
 13     "KeySchema": [
 14         {
 15             "AttributeName": "testCase",
 16             "KeyType": "HASH"
 17         },
 18         {
 19             "AttributeName": "cFlags",
 20             "KeyType": "RANGE"
 21         }
 22     ],
 23     "ProvisionedThroughput": {
 24         "ReadCapacityUnits": 1,
 25         "WriteCapacityUnits": 1
 26     }
 27 }

However, in pratcice, the cFlags attribute is not a string, but rather an unordered set of strings*. I read here that:

DynamoDB supports types that represent sets of Number, String, or Binary values.

Yet, I read here that the options for the AttributeType field are only the scalar ones:

AttributeType The data type for the attribute, where:

  • S - the attribute is of type String
  • N - the attribute is of type Number
  • B - the attribute is of type Binary

    Type: String

    Valid Values: S | N | B

    Required: Yes

I have tried to define the attribute type of cFlags in various ways, none of which seem to work:

  • "AttributeType": [ "S" ]
  • "AttributeType": "[ S ]"
  • "AttributeType": "SS"

Could someone explain what I am not doing right and what is the correct way to do what I want in DynamoDB ?


*An example would be the string -O -Werror as in the case of a gcc invocation such as gcc -O -Werror src_file.c. It makes no difference whether gcc in invoked with -O -Werror or -Werror -O. So in my use case, the unordered set [ "-O", "-Werror" ] defines one potential value of the cFlags attribute.

1 Answers
Related