dynobase-icon
Dynobase

DynamoDB Deletion Protection: How to Enable and Verify It

Rafal Wilinski

Written by Rafal Wilinski

Published: November 20th, 2026

Keeping on-demand backups in order? List, create, restore and delete a table's on-demand backups from its context menu in Dynobase. Backup manager in Dynobase

To prevent accidental DynamoDB table deletion, set DeletionProtectionEnabled to true when you create or update the table. DynamoDB then rejects DeleteTable even for an administrator with permission to call it. Authorized item deletes and Time to Live (TTL) expiration still work. For a global table, enable and verify the setting on each replica. AWS deletion protection guide, AWS global table guidance.

What DynamoDB deletion protection covers

The flag defaults to off, including on new replicas and tables restored from backups. A planned deletion takes two steps: an authorized principal turns protection off with UpdateTable, then a principal with dynamodb:DeleteTable can delete the DynamoDB table. The setting guards normal table management calls. AWS also documents that closing an account can still lead to table deletion and that DynamoDB can archive a table if it loses access to its customer managed encryption key. AWS table operations, UpdateTable API.

Your application can still use DeleteItem or send delete requests in BatchWriteItem if its role is allowed to do so. TTL still removes expired items on tables where it is enabled. Use IAM to restrict destructive writes and backups to recover from unwanted data changes.

Does it protect global table replicas?

Yes. Deletion protection belongs to the individual replica, and DynamoDB configures it independently even for multi-account global tables. Set it in every replica Region, using credentials for the owning account, and check each Region after you add a replica. For CloudFormation global tables, set DeletionProtectionEnabled: true on each entry in Replicas. Same-account settings, multi-account settings, CloudFormation replica properties.

Enable and check DynamoDB deletion protection

Select the intended AWS account and Region before running the examples. The CLI, SDK, and Terraform examples use an on-demand table named Orders with a string partition key called orderId.

AWS Management Console

  1. New table. In DynamoDB, choose Tables → Create table, enter the table details, choose Customize settings, and turn on Deletion protection before creating it. AWS console walkthrough.
  2. Existing table. Open the table, choose Additional settings, and enable protection in the Deletion protection panel. Check the same panel after saving. AWS DynamoDB Developer Guide.

AWS CLI v2

Use --deletion-protection-enabled with create-table to protect a new table.

For an existing table, use update-table.

Wait for the table to become ACTIVE, then check the live value. The expected output is true. For a global table, repeat the check with --region set to each replica's Region. AWS CLI waiter, DescribeTable result fields.

AWS SDK for JavaScript v3

Use the low-level @aws-sdk/client-dynamodb client. Run one of CreateTableCommand or UpdateTableCommand, then check with DescribeTable after the table is active.

Save it as protect-orders.mjs. Run node protect-orders.mjs --create for a new table or node protect-orders.mjs for an existing one. See the AWS SDK waiter example.

Python with boto3

Pass DeletionProtectionEnabled=True to create_table or update_table. Save as protect_orders.py and use --create only for a new table.

CloudFormation

Set DeletionProtectionEnabled under Properties on AWS::DynamoDB::Table. For an existing stack-managed table, add the property to the existing logical resource and deploy a stack update. AWS documents this change as No interruption. The two retention attributes in this example are separate safeguards, explained below. AWS table resource reference, DynamoDB CloudFormation examples.

AWS CDK v2

Set deletionProtection: true on Table when you define it. For an existing CDK-managed table, change the property on the same construct and deploy the existing stack. For TableV2 global tables, configure deletionProtection for the primary and in each replica's settings. CDK TableProps, CDK DynamoDB construct reference.

Terraform

Set deletion_protection_enabled = true on aws_dynamodb_table. For an existing table already in Terraform state, add it to that resource, check that terraform plan shows an in-place update, and apply. The AWS provider sends the flag in UpdateTable when this argument changes. HashiCorp AWS provider reference, provider update implementation.

Restrict who can turn deletion protection off

DeletionProtectionEnabled is an API field. The DynamoDB IAM authorization reference lists no condition key that lets IAM distinguish true from false on dynamodb:UpdateTable. The aws:ResourceTag condition can scope a rule to selected tables. The rule still governs the whole action, including changes to throughput, indexes, and streams. AWS guidance on table guardrails.

  • Give application roles only the item operations they need. Reserve dynamodb:UpdateTable for a controlled maintenance or deployment role scoped to the required table ARNs. Give dynamodb:DeleteTable only to the role responsible for approved deletions. Review who can invoke CloudFormation stack updates too, because a stack can use its configured service role on the caller's behalf. DynamoDB access control, CloudFormation service roles.
  • For an explicit guardrail across a member account, use an AWS Organizations service control policy (SCP). For example, deny dynamodb:UpdateTable on the production table ARN unless aws:PrincipalArn matches your approved maintenance role's IAM ARN. Add an independently scoped deny for dynamodb:DeleteTable if deletion has a different approval path. An SCP limits permissions. The excepted role still needs an IAM allow, and management-account principals and service-linked roles are outside SCP restrictions. SCP scope, IAM principal ARN condition.
  • A DynamoDB table resource policy can add an explicit deny on UpdateTable or DeleteTable for unwanted principals. If you use table tags to select protected resources, also restrict who can change those tags. Review the replica-management actions and replica ARNs for global tables. Supported resource-policy actions, AWS global tables IAM guidance.

Verify the setting and the permission separately

On a disposable table covered by the same rules, try update-table --no-deletion-protection-enabled as the application role. Expect an access-denied response and confirm that DescribeTable still shows true. Verify that the authorized maintenance role can change the setting and re-enable it. Test IAM against the real policies and role sessions. AWS documents simulator limits for conditional SCPs and resource policies on roles. Check the Region's CloudTrail management events for UpdateTable, including the caller and request parameters. Audit the live setting at scale with Security Hub control DynamoDB.6 or the AWS Config rule dynamodb-table-deletion-protection-enabled. IAM policy simulator, DynamoDB CloudTrail events, Security Hub controls.

CloudFormation and CDK stack deletion

SettingEffect
DeletionProtectionEnabled: trueDynamoDB rejects a delete request from any caller, including CloudFormation. AWS table resource reference
DeletionPolicy: RetainCloudFormation keeps the physical table when you delete the stack or remove the resource from the template. DeletionPolicy
UpdateReplacePolicy: RetainCloudFormation keeps the old physical table if a stack update replaces it. UpdateReplacePolicy
CDK RemovalPolicy.RETAINFor the Table above, CDK synthesizes both retention attributes. Check them with cdk synth. CDK resource policies, CDK implementation

If CloudFormation tries to delete a protected table, DynamoDB rejects the request and the stack can reach DELETE_FAILED. Other resources may already have been deleted. To finish the stack deletion and keep the table, choose Retry delete → Delete this stack but retain resources and select the table, or retry with the table's logical ID in RetainResources. If the table itself is meant to be deleted, disable protection as an authorized role before retrying. For planned stack teardown that should preserve data, declare Retain while the stack is still healthy. AWS stack deletion procedure, CloudFormation troubleshooting.

What error do you see when deleting a protected table?

AWS documents this CLI response to aws dynamodb delete-table --table-name Orders when the caller has delete permission and protection is enabled. AWS re:Post Knowledge Center.

Confirm the protection flag with DescribeTable. If you see an access-denied error, check the caller's effective IAM permissions, the resource policy, and any applicable SCP. AWS IAM evaluation logic.

Layered protection checklist

  • Deletion protection. Enable it in infrastructure code on production tables and verify the live value in every replica Region. AWS global table guidance.
  • PITR. Turn on DynamoDB point-in-time recovery to recover from accidental item deletes and bad writes. The continuous recovery window is configurable from 1 to 35 days while the source table exists. AWS PITR reference.
  • AWS Backup. Schedule backups with a retention period that meets your recovery requirements, and periodically restore one to verify the procedure. AWS Backup for DynamoDB.
  • Resource policies. Apply table-level explicit denies where an accidental grant would expose table updates or deletions. AWS resource policy authorization.
  • Least privilege. Grant table administration only to the roles that need it. Scope application roles to the tables and data operations they actually use. AWS DynamoDB IAM guidance.

Recover after an accidental DynamoDB table deletion

Start by checking the source account and Region for the available recovery points. The options depend on what was enabled before the deletion.

Recovery sourceWhat you can restore and for how long
PITR was enabled when the table was deletedAt deletion, DynamoDB creates a SYSTEM backup named like Orders$DeletedTableBackup. It is retained for 35 days and restores the table as it stood just before deletion. The rolling PITR timeline is available while the original table exists. AWS PITR deletion behavior
DynamoDB on-demand backupRestore a previously taken snapshot. DynamoDB retains these backups until you explicitly delete them. AWS DynamoDB backup features
AWS Backup recovery pointRestore a snapshot from its AWS Backup vault before it expires under the backup plan's retention rules. AWS Backup lifecycle and restores

For a system backup, run aws dynamodb list-backups --table-name Orders --backup-type SYSTEM. Match the backup to the deleted table and the incident time, then restore it using aws dynamodb restore-table-from-backup with its --backup-arn and a --target-table-name. For an AWS Backup recovery point, start the restore in AWS Backup. ListBackups API, DynamoDB CLI restore procedure, AWS Backup restore procedure.

If the table still exists and the incident deleted items, use RestoreTableToPointInTime with a timestamp before the unwanted writes, within the available PITR window. If the whole table is gone and both PITR and existing backups were absent, there is no DynamoDB recovery point to restore. RestoreTableToPointInTime API, AWS PITR deletion behavior.

The restore creates a new physical table. Wait for it to become active, check the data, re-enable deletion protection and PITR, and reapply the applicable access policies, TTL, and stream settings before redirecting application traffic. See the DynamoDB backup and restore guide for the restore workflow and AWS restore settings for what to reconfigure.

Frequently Asked Questions

What does DynamoDB DeletionProtectionEnabled do?

When true, it blocks DeleteTable until an authorized caller turns protection off. Item deletion and TTL expiration can still occur.

How do I check whether deletion protection is enabled?

Read Table.DeletionProtectionEnabled in DescribeTable or check the Deletion protection panel in the DynamoDB console. For a global table, check each replica in its own Region.

Can IAM allow enabling DynamoDB deletion protection while denying disabling it?

DynamoDB exposes no IAM condition key for the flag. Restrict UpdateTable on the relevant table to approved roles. That restriction applies to other changes made through UpdateTable as well.

Will CloudFormation delete a protected DynamoDB table?

DynamoDB rejects the delete and the stack can reach DELETE_FAILED. A Retain deletion policy tells CloudFormation to keep the table when the stack is deleted.

Can I recover a DynamoDB table after deleting it?

If PITR was enabled at deletion, DynamoDB keeps a snapshot of the table just before deletion for 35 days. You can also restore an available DynamoDB on-demand backup or AWS Backup recovery point.

Dynobase is a Professional GUI Client for DynamoDB

Start your 7-day free trial today

Product Features

Download
/
Changelog
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2026 Dynobase