Operation CRUD is atomic in DynamoDB. The API is not available to delete all elements of the DynamoDB table.
Solution 1:
The best recommended solution is to delete the table and recreate it.
Solution 2:
Use batchWriteItem with DeleteRequest to delete multiple items at a time. The maximum number of packet write requests is 25 items.
Wait: -
After executing the deletion table, wait until the resource is unavailable. Similarly, after executing the create table, you need to wait until the resource is available.
var params = {
TableName: 'STRING_VALUE'
};
dynamodb.waitFor('tableNotExists', params, function(err, data) {
if (err) console.log(err, err.stack);
else console.log(data);
});
Expects the NotExists table to declare, periodically invoking DynamoDB.describeTable () operations every 20 seconds (with more than 25 times).
source
share