[英]AWS - Unable to create Localstack DynamoDB table from JSON
我有一个 DynamoDB JSON 文件,如下所示:
{
"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"
}
我正在尝试通过运行以下命令在 Localstack 中创建相应的 DynamoDB 表:
aws dynamodb create-table --endpoint-url http://localhost:4566 --region us-east-1 --cli-input-file file:///MY_TABLE.json
但是,当我运行此命令时,我收到一条错误消息:
aws: error: the following arguments are required: --attribute-definitions, --table-name, --key-schema
所有这些项目都存在于 JSON 文件中。 为什么 cli 不喜欢该命令?
似乎不支持选项--cli-input-file
。
您应该改用--cli-input-json
或--cli-input-yaml
:
aws dynamodb create-table \
--endpoint-url http://localhost:4566 \
--region us-east-1 \
--cli-input-json file://MY_TABLE.json
注意:
NonKeyAttributes
的非空列表
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.