我正在使用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)