# ##################################### ## Gherkin ## ##################################### # Rule Identifier: # RDS_INSTANCE_DELETION_PROTECTION_ENABLED # # Description: # Checks if an Amazon Relational Database Service (Amazon RDS) instance has deletion protection enabled. # # Reports on: # AWS::RDS::DBInstance # # Evaluates: # AWS CloudFormation # # Rule Parameters: # NA # # Scenarios: # a) SKIP: when there are no RDS instances present # b) PASS: when all RDS instances have DeletionProtection set to true # c) FAIL: when all RDS instances have DeletionProtection set to false # d) FAIL: when there are RDS instances with DeletionProtection property is not present # e) SKIP: when metadata includes the suppression for rule RDS_INSTANCE_DELETION_PROTECTION_ENABLED # # Select all RDS instance resources from incoming template (payload) # let aws_rds_instances_deletion_protection_enabled = Resources.*[ Type == 'AWS::RDS::DBInstance' Metadata.guard.SuppressedRules not exists or Metadata.guard.SuppressedRules.* != "RDS_INSTANCE_DELETION_PROTECTION_ENABLED" ] rule RDS_INSTANCE_DELETION_PROTECTION_ENABLED when %aws_rds_instances_deletion_protection_enabled !empty { %aws_rds_instances_deletion_protection_enabled.Properties.DeletionProtection EXISTS %aws_rds_instances_deletion_protection_enabled.Properties.DeletionProtection == true << Violation: All RDS instances must deletion protection enabled. Fix: Set the parameter for DeletionProtection to true. >> }