dynobase-icon
Dynobase

DynamoDB: Delete Table (Guide w/ Code Examples)

Rafal Wilinski

Provided by Rafal Wilinski

To delete a DynamoDB table using the JavaScript SDK, you can use the deleteTable method. The below example shows how to use this method to delete a table.

However, it will only delete the table if it already exists and no longer has any items or if you set the skip_table_deletion flag to true. Also, the table must be in the ACTIVE state.

const AWS = require('aws-sdk'); const dynamodb = new AWS.DynamoDB(); const params = { TableName: 'myTable' }; dynamodb.deleteTable(params, (err, data) => { if (err) { console.error("Unable to delete table. Error JSON:", JSON.stringify(err, null, 2)); } else { console.log("Deleted table. Table description JSON:", JSON.stringify(data, null, 2)); } });

Spend less time in the AWS console, use Dynobase.

Try 7-day free trial. No credit card needed.

Product Features

Download
/
Changelog
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2024 Dynobase
+
Using DynamoDB Console frequently?
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.