DocumentDB cluster has deletion protection enabled
Amazon DocumentDB clusters are evaluated for the deletion_protection setting on the cluster configuration.
The finding highlights clusters where this protection is not enabled.
Risk
Without deletion protection, clusters can be deleted by mistake or misuse, causing sudden outage and loss of recovery points, impacting availability and data integrity.
Compromised accounts or faulty automation can remove databases or skip final snapshots, hindering restoration.
Run this check with Prowler
Run in Prowler Cloudprowler aws --checks documentdb_cluster_deletion_protectionRecommendation
Enable deletion protection on all non-ephemeral clusters, prioritizing production.
Enforce least privilege for delete and modify actions, require change control to toggle protection, and implement defense in depth with automation that continuously enforces this setting. Before decommissioning, take a final snapshot.
Remediation
CLI
aws docdb modify-db-cluster --db-cluster-identifier <DB_CLUSTER_ID> --deletion-protection --apply-immediatelyTerraform
# Terraform: Enable deletion protection on a DocumentDB cluster
resource "aws_docdb_cluster" "<example_resource_name>" {
master_username = "<MASTER_USERNAME>"
master_password = "<MASTER_USER_PASSWORD>"
deletion_protection = true # CRITICAL: Prevents cluster deletion until disabled
}NativeIaC
# CloudFormation: Enable deletion protection on a DocumentDB cluster
Resources:
<example_resource_name>:
Type: AWS::DocDB::DBCluster
Properties:
MasterUsername: "<MASTER_USERNAME>"
MasterUserPassword: "<MASTER_USER_PASSWORD>"
DeletionProtection: true # CRITICAL: Prevents cluster deletion until disabledOther
Check Code
from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.documentdb.documentdb_client import (
documentdb_client,
)
class documentdb_cluster_deletion_protection(Check):
def execute(self):
findings = []
for cluster in documentdb_client.db_clusters.values():
report = Check_Report_AWS(metadata=self.metadata(), resource=cluster)
report.status = "FAIL"
report.status_extended = f"DocumentDB Cluster {cluster.id} does not have deletion protection enabled."
if cluster.deletion_protection:
report.status = "PASS"
report.status_extended = (
f"DocumentDB Cluster {cluster.id} has deletion protection enabled."
)
findings.append(report)
return findingsReferences
- https://support.icompaas.com/support/solutions/articles/62000233689-ensure-documentdb-clusters-has-deletion-protection-enabled
- https://www.trendmicro.com/trendaivisiononecloudriskmanagement/knowledge-base/aws/DocumentDB/deletion-protection.html
- https://docs.aws.amazon.com/documentdb/latest/developerguide/db-cluster-delete.html
- https://docs.aws.amazon.com/securityhub/latest/userguide/documentdb-controls.html#documentdb-5