小编Avi*_*eet的帖子

如何从java脚本中为DynamoDB中的预配置读取容量启用Auto Scaling

我正在使用AWS SDK for nodejs并从代码中创建一个dynamodb表.一切正常但我需要自动扩展才能启用配置的读写容量.这是我正在尝试的代码

var params = {
    TableName : "MyTable",
    KeySchema: [       
        { AttributeName: "Name", KeyType: "HASH"},  //Partition key
        { AttributeName: "time", KeyType: "RANGE" }  //Sort key
    ],
    AttributeDefinitions: [     

        { AttributeName: "Name", AttributeType: "S" },
        { AttributeName: "time", AttributeType: "N" }
    ],
    ProvisionedThroughput: {       
        ReadCapacityUnits: 5, 
        WriteCapacityUnits: 5
    }        
    ]
};

dynamodb.createTable(params, function(err, data) {
    if (err) {
        console.error("Unable to create table. Error JSON:", JSON.stringify(err, null, 2));
    } else {
        console.log("Created table. Table description JSON:", JSON.stringify(data, null, 2)); …
Run Code Online (Sandbox Code Playgroud)

javascript node.js amazon-dynamodb aws-sdk aws-sdk-js

6
推荐指数
2
解决办法
1308
查看次数