# ##################################### ## Gherkin ## ##################################### # Rule Identifier: # DB_INSTANCE_BACKUP_ENABLED # # Description: # Checks if RDS DB instances have backups 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 BackupRetentionPeriod set to a positive number # c) FAIL: when all RDS instances have BackupRetentionPeriod set to 0 # d) FAIL: when there are RDS instances with BackupRetentionPeriod property is not present # e) SKIP: when metadata includes the suppression for rule DB_INSTANCE_BACKUP_ENABLED # # Select all RDS instance resources from incoming template (payload) # let aws_rds_instances_db_instance_backup_enabled = Resources.*[ Type == 'AWS::RDS::DBInstance' Metadata.guard.SuppressedRules not exists or Metadata.guard.SuppressedRules.* != "DB_INSTANCE_BACKUP_ENABLED" ] rule DB_INSTANCE_BACKUP_ENABLED when %aws_rds_instances_db_instance_backup_enabled !empty { %aws_rds_instances_db_instance_backup_enabled.Properties.BackupRetentionPeriod EXISTS %aws_rds_instances_db_instance_backup_enabled.Properties.BackupRetentionPeriod >= 1 << Violation: All RDS instances must have automated backup enabled. Fix: Set the BackupRetentionPeriod to values of 1 to 35 to enable backups. >> }