使用aws cli创建dynamodb表“--cli-input-json”

时间:2017-10-09 02:11:46

标签: amazon-web-services amazon-dynamodb aws-cli

我一直在尝试使用以下json(testbootstraptable.json)文件创建一个dynamo db表:

{
        "AttributeDefinitions": [
            {
                "AttributeName": "test1",
                "AttributeType": "S"
            },
            {
                "AttributeName": "test2",
                "AttributeType": "S"
            }
        ],
        "TableName": "BOOTSTRAP_TEST_TBL",
        "KeySchema": [
            {
                "AttributeName": "test1",
                "KeyType": "HASH"
            },
            {
                "AttributeName": "test2",
                "KeyType": "RANGE"
            }
        ],
        "ProvisionedThroughput": {
            "NumberOfDecreasesToday": 0,
            "ReadCapacityUnits": 35,
            "WriteCapacityUnits": 35
        }
}

我已尝试多次基于谷歌搜索的不同变体,但不断收到以下错误:

Error parsing parameter 'cli-input-json': Invalid JSON: Expecting value: line 1 column 1 (char 0)
JSON received: testbootstraptable.json

AWS Command:

$ aws dynamodb create-table --cli-input-json testbootstraptable.json --region us-west-2

1 个答案:

答案 0 :(得分:5)

添加" file://" to testbootstraptable.json

aws dynamodb create-table --cli-input-json file://testbootstraptable.json --region us-west-2

另外,删除以下行,因为它不正确: " NumberOfDecreasesToday":0,