Reputation: 1199
How can I clear all items from a DynamoDb table without deleting and recreating the table? The table is created/defined using CloudFormation so I don't want to duplicate that concern in business code.
I'm using TypeScript/NodeJs.
This question says to scan every item, chunk into blocks of 25, then delete each item using BatchWrite
, however:
Is there a better way? Am I missing something?
Upvotes: 1
Views: 3670
Reputation: 23823
Nope, those are your only two options:
Why is this needed?
If this really is a "common need" for your application.. Have you considered more ephemeral storage, such as Elasticache?
What about DDB's ability to automatically expire and removed items via TTL functionality?
Upvotes: 2