小编NAb*_*bas的帖子

密钥模式中的属性数必须与属性定义中定义的属性数相匹配

我正在尝试使用DynamoDB javascript shell创建一个简单的表,我得到了这个异常:


    {   
    "message": "The number of attributes in key schema must match the number of attributes defined in attribute definitions.",
    "code": "ValidationException",
    "time": "2015-06-16T10:24:23.319Z",
    "statusCode": 400,
    "retryable": false 
    }

下面是我要创建的表:


    var params = {
        TableName: 'table_name',
        KeySchema: [ 
            { 
                AttributeName: 'hash_key_attribute_name',
                KeyType: 'HASH',
            },

        ],
        AttributeDefinitions: [ 
            {
                AttributeName: 'hash_key_attribute_name',
                AttributeType: 'S', 
            },
            {
                AttributeName: 'attribute_name_1',
                AttributeType: 'S', 
            }
        ],
        ProvisionedThroughput: { 
            ReadCapacityUnits: 1, 
            WriteCapacityUnits: 1, 
        },


    };
    dynamodb.createTable(params, function(err, data) {
        if (err) print(err); 
        else print(data); 
    }); …
Run Code Online (Sandbox Code Playgroud)

amazon-dynamodb dynamo-local

82
推荐指数
3
解决办法
4万
查看次数

标签 统计

amazon-dynamodb ×1

dynamo-local ×1