Truncating a DynamoDB Table
# Truncating a DynamoDB Table
You may need to empty a DynamoDB table of it row entries, but deleting the table will also delete the table instance. This is where a truncate operation is helpful, as it deletes the row entries but not the table instance. Commandeer easily facilitates this process and insures your success.
# What is Table Truncation
A DynamoDB table can store large amounts of data. Truncating your DynamoDB table empties the content of it while still keeping your table instance. As opposed to deleting a table, where both your data and the table instance are deleted.
Truncating a table is useful for development purposes. While you're developing some new software or playing with the data in the table, it's convenient to be able to clear the data to start fresh. Just don't truncate your production tables 🤫.
# How to Truncate Your Table
Truncating the data works with LocalStack as well as with a real AWS account.
Truncating your table is easy. Go to your DynamoDB table dashboard. You can navigate there from DynamoDB -> Tables -> YourTable -> Dashboard. Click on the truncate button to truncate your table.
You'll see a confirmation dialog asking you to type
TRUNCATE to confirm. Since truncating your table is a destructive operation, it doesn't hurt to confirm to be safe. Type
TRUNCATE and click yes.
Once the data is truncated, you can check the
Data tab in the side navigation to make sure the data is cleared.
Truncating your DynamoDB table data is very straightforward in Commandeer. With a click of a button, you'll be able to clear your data and start fresh in no time. Cheers!
Join Commandeer Newsletter for more productivity tips.