Reputation: 12039
I have a DynamoDB JSON file that looks like this:
{
"AttributeDefinitions": [
{
"AttributeName": "pk",
"AttributeType": "S"
},
{
"AttributeName": "sk",
"AttributeType": "S"
}
],
"TableName": "MYTABLE",
"KeySchema": [
{
"AttributeName": "pk",
"KeyType": "HASH"
},
{
"AttributeName": "sk",
"KeyType": "RANGE"
}
],
"GlobalSecondaryIndexes": [
{
"IndexName": "GSIReverseIndex",
"KeySchema": [
{
"AttributeName": "pk",
"KeyType": "RANGE"
},
{
"AttributeName": "sk",
"KeyType": "RANGE"
}
],
"Projection": {
"ProjectionType": "ALL",
"NonKeyAttributes": [
""
]
},
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}
],
"BillingMode": "PROVISIONED",
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
},
"StreamSpecification": {
"StreamEnabled": true,
"StreamViewType": "NEW_AND_OLD_IMAGES"
},
"TableClass": "STANDARD"
}
I am trying to create the corresponding DynamoDB table in Localstack by running the following command:
aws dynamodb create-table --endpoint-url http://localhost:4566 --region us-east-1 --cli-input-file file:///MY_TABLE.json
However, when I run this command I get an error saying:
aws: error: the following arguments are required: --attribute-definitions, --table-name, --key-schema
All of those items are present in the JSON file. Why doesn't the cli like the command?
Upvotes: 0
Views: 1051
Reputation: 840
It seems that the option --cli-input-file
is not supported.
You should use --cli-input-json
or --cli-input-yaml
instead:
aws dynamodb create-table \
--endpoint-url http://localhost:4566 \
--region us-east-1 \
--cli-input-json file://MY_TABLE.json
Note that:
NonKeyAttributes
for GSI projectionUpvotes: 1