Skip to main content

Aurora DB Clusters Should Have Recovery Point Within

More Info:​

Checks if a recovery point was created for Amazon Aurora DB clusters. The rule is NON_COMPLIANT if the Amazon Relational Database Service (Amazon RDS) DB Cluster does not have a corresponding recovery point created within the specified time period.

Risk Level​

High

Address​

Configuration

Compliance Standards​

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
  • UK NCSC Cyber Assessment Framework

Triage and Remediation​

Remediation​

Using Console

Sure, here are the steps to remediate this issue:

  1. Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/.

  2. In the navigation pane, choose 'Databases'.

  3. Choose the name of the Aurora DB cluster that you want to modify.

  4. Choose 'Modify'.

  5. In the 'Backup' section, for 'Backup Retention Period', choose a value other than '0' days. The value you choose specifies how many recent automatic backups to retain. You can choose from '1' to '35' days.

  6. Choose 'Continue'.

  7. Review your changes on the summary page, then choose 'Modify DB Cluster' to save your changes.

  8. Wait for the 'Status' of your DB cluster to show as 'Available' before you try to work with it.

Note: Modifying a DB cluster to enable automatic backups doesn't create an automatic backup immediately. Automatic backups are taken during the backup window of the DB cluster.

By setting a backup retention period, you ensure that you can restore your database to any point in time within the "retention period". This is crucial for data recovery in case of any accidental data deletion or corruption.

Using CLI

In order to remediate this issue, you need to enable automated backups for your Amazon RDS DB instance. Automated backups are deleted when the DB instance is deleted. Here are the steps to remediate this issue:

  1. First, you need to install AWS CLI on your system. You can download it from the official AWS website and install it based on your operating system.

  2. Open your terminal or command prompt and configure AWS CLI using the command aws configure. You will be asked to enter your AWS Access Key ID, Secret Access Key, default region name, and default output format. Fill in the details accordingly.

  3. Once AWS CLI is configured, you can use the following command to modify the RDS instance and set the backup retention period. Replace 'DBInstanceIdentifier' with the name of your DB instance, and 'BackupRetentionPeriod' with the number of days you want to retain your backup (for example, 7 days).

aws rds modify-db-instance --db-instance-identifier DBInstanceIdentifier --backup-retention-period BackupRetentionPeriod
  1. Press Enter to execute the command. AWS RDS will then enable automated backups for the specified DB instance.

  2. You can verify the backup policy by using the following command:

aws rds describe-db-instances --db-instance-identifier DBInstanceIdentifier

Look for the 'BackupRetentionPeriod' field in the output. It should reflect the number of days you set in step 3.

Note: You need to have necessary permissions to modify RDS instances and to create backups. If you don't have these permissions, you'll need to request them from your AWS administrator.

Using Python

To remediate the issue you need to create a backup for the Aurora DB Cluster. Below are the steps to create a backup using python with the help of the boto3 library:

  1. Install the boto3 library if you haven't already. You can do it using pip:

    pip install boto3
  2. Import the necessary libraries and create a session using your AWS credentials:

    import boto3

    session = boto3.Session(
    aws_access_key_id='YOUR_ACCESS_KEY',
    aws_secret_access_key='YOUR_SECRET_KEY',
    region_name='us-west-1' # your region here
    )
  3. Create an RDS client:

    rds = session.client('rds')
  4. Call the create_db_cluster_snapshot method to create a snapshot:

    response = rds.create_db_cluster_snapshot(
    DBClusterSnapshotIdentifier='your_snapshot_name',
    DBClusterIdentifier='your_cluster_name'
    )
  5. Check the status of the snapshot creation:

    response = rds.describe_db_cluster_snapshots(
    DBClusterSnapshotIdentifier='your_snapshot_name',
    )

    status = response['DBClusterSnapshots'][0]['Status']
    print('Snapshot Status: ', status)

Remember to replace 'your_snapshot_name' and 'your_cluster_name' with your actual snapshot and DB cluster names.

This script will create a snapshot of your DB cluster. It's a good practice to create snapshots regularly to have recovery points.

Using Terraform
# Enables automated backups for the Aurora cluster and sets the retention
# period to 7 days (valid range: 1–35)
resource "aws_rds_cluster" "AURORA_CLUSTER" {
cluster_identifier = "AURORA_CLUSTER_IDENTIFIER" # replace with your cluster ID

# ... other required arguments: engine, master_username, master_password, etc.

backup_retention_period = 7
preferred_backup_window = "02:00-03:00" # replace with your desired UTC window

# NOTE: AWS applies changes like backup_retention_period in the next
# maintenance window by default; applying immediately may cause a brief outage
}

# Creates a manual snapshot of the Aurora cluster (point-in-time fix)
resource "aws_db_cluster_snapshot" "AURORA_CLUSTER_MANUAL_SNAPSHOT" {
db_cluster_identifier = aws_rds_cluster.AURORA_CLUSTER.id
db_cluster_snapshot_identifier = "AURORA_CLUSTER_MANUAL_SNAPSHOT_ID" # use a unique name
# WARNING: Manual snapshots are retained (and billed) until you delete them.
}

This change does not force replacement of the DB cluster; backup_retention_period and creating aws_db_cluster_snapshot are in-place operations, though enabling backups and snapshot creation may briefly impact performance during backup windows.

To verify, terraform plan should show:

  • aws_rds_cluster.AURORA_CLUSTER: backup_retention_period changing to 7 (or being added as 7).
  • aws_db_cluster_snapshot.AURORA_CLUSTER_MANUAL_SNAPSHOT: a new resource to be created.

Additional Reading:​