使用node.js我尝试删除并再次创建dynamoDB表。我需要从表中删除所有记录并放入新的,所以我认为是删除和重新创建整个表的好方案。我尝试用这个代码删除并创建dynamoDB表
dynamo.deleteTable({
TableName: tableName
}, function(err, data){
if (err) {
console.log(err);
}
else {
dynamo.createTable({
TableName: tableName,
KeySchema: [{
AttributeName: "id",
KeyType: "HASH"
}],
AttributeDefinitions: [{
AttributeName: "id",
AttributeType: "S"
}],
ProvisionedThroughput: {
ReadCapacityUnits: 10,
WriteCapacityUnits: 10
}
}, function(err){
if (err) {
console.log(err);
}
else {
// putNewData(data, callback);
}
})
}
});
,我得到错误ResourceInUseException:表已经存在:
不错的解决方案,tnx – Nemanja