# ##################################### ## Gherkin ## ##################################### # Rule Identifier: # RDS_SNAPSHOT_ENCRYPTED # # Description: # Checks whether Amazon Relational Database Service (Amazon RDS) DB snapshots are encrypted. # # # 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 StorageEncrypted set to true # c) FAIL: when all RDS instances have StorageEncrypted set to false # d) FAIL: when there are RDS instances with StorageEncrypted property is not present # e) SKIP: when metadata includes the suppression for rule RDS_SNAPSHOT_ENCRYPTED # # Select all RDS instance resources from incoming template (payload) # let aws_rds_instances_snapshot_encrypted = Resources.*[ Type == 'AWS::RDS::DBInstance' Metadata.guard.SuppressedRules not exists or Metadata.guard.SuppressedRules.* != "RDS_SNAPSHOT_ENCRYPTED" ] rule RDS_SNAPSHOT_ENCRYPTED when %aws_rds_instances_snapshot_encrypted !empty { %aws_rds_instances_snapshot_encrypted.Properties.StorageEncrypted EXISTS %aws_rds_instances_snapshot_encrypted.Properties.StorageEncrypted == true << Violation: All RDS instances must have snapshots encrypted. Fix: Set the StorageEncrypted parameter to true so by default all snapshots are encrypted. >> }