RDS Continuous backup solution

0

We have deployed Amazon RDS through CFT, and now we plan to enable automated backup and replicate the backup across regions through CFT. the below lines add to the existing CFT and deploy the CFT but when we check in the RDS console Automated backup is not enabled. BackupRetentionPeriod: '30' AutomaticBackupReplicationRegion: AutomaticBackupReplicationKmsKeyId: PreferredBackupWindow: 02:00-03:00

Through the RDS console able to enable Automate backup and able to deploy the new RDS through CFT adding the above lines and checked the RDS console automate backup is enabled.

asked 2 months ago297 views
2 Answers
0

Hi balakrishna221982,

Please go through the below steps and documentation links once, i hope it will help solve your issue.

To enable automated backups and cross-region automated backups for Amazon RDS using CloudFormation, you'll need to correctly configure the CloudFormation template with the relevant properties. Below is a brief explanation of each property:

BackupRetentionPeriod: Defines the number of days that automated backups are retained. Setting this to 0 disables automated backups. If you're setting it to 30, this should retain the backups for 30 days.

PreferredBackupWindow: Specifies the daily time range in UTC during which automated backups are created.

AutomaticBackupReplicationRegion: Specifies the target region for automated backup replication. This is used to replicate backups across regions.

AutomaticBackupReplicationKmsKeyId: Specifies the KMS key ID used to encrypt the automated backups in the target region.

Here is an example of how these properties can be added to your CloudFormation template:

Resources:
  MyDBInstance:
    Type: "AWS::RDS::DBInstance"
    Properties:
      DBInstanceIdentifier: "mydbinstance"
      AllocatedStorage: "100"
      DBInstanceClass: "db.t3.medium"
      Engine: "mysql"
      MasterUsername: "admin"
      MasterUserPassword: "password"
      BackupRetentionPeriod: 30
      PreferredBackupWindow: "02:00-03:00"
      AutomaticBackupReplicationRegion: "us-west-2"
      AutomaticBackupReplicationKmsKeyId: "your-kms-key-id"

Common Issues:

  • BackupRetentionPeriod Not Set: Ensure that BackupRetentionPeriod is set to a value greater than 0, otherwise, automated backups will be disabled.

  • Cross-Region Backup Not Enabled: Make sure that the AutomaticBackupReplicationRegion and AutomaticBackupReplicationKmsKeyId are correctly specified.

  • Verify through the Console: After deploying the CloudFormation stack, you should see automated backups enabled and cross-region replication in the RDS console.

References:

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbinstance.html#cfn-rds-dbinstance-backupretentionperiod

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReplicateBackups.html

EXPERT
answered 2 months ago
profile picture
EXPERT
Sandeep
reviewed 2 months ago
  • Hi trying enable Automate backup for existing RDS but same works fine for new RDS deployment BackupRetentionPeriod: 30 AutomaticBackupReplicationRegion: eu-west-3 AutomaticBackupReplicationKmsKeyId: !Ref DRBackupreplicationkmskey PreferredBackupWindow: '02:00-03:00'

0

Check Your CloudFormation Template

Make sure the properties are correctly defined in your CloudFormation template under the AWS::RDS::DBInstance resource.

Resources:
  MyDBInstance:
    Type: "AWS::RDS::DBInstance"
    Properties:
      DBInstanceIdentifier: "my-db-instance"
      Engine: "mysql"
      DBInstanceClass: "db.t3.medium"
      MasterUsername: "admin"
      MasterUserPassword: "yourpassword"
      AllocatedStorage: "20"
      BackupRetentionPeriod: 30
      PreferredBackupWindow: "02:00-03:00"
      CopyTagsToSnapshot: true
      EnableCloudwatchLogsExports:
        - "audit"
        - "error"
      BackupRetentionPeriod: 30
      MultiAZ: true
      VPCSecurityGroups:
        - !Ref MyDBSecurityGroup
      AutomaticBackupReplicationRegion: "us-west-2" # example region
      AutomaticBackupReplicationKmsKeyId: "your-kms-key-id"

2.Ensure Correct Syntax and Parameters Ensure that the BackupRetentionPeriod, AutomaticBackupReplicationRegion, and AutomaticBackupReplicationKmsKeyId are correctly specified and supported for your RDS engine.

3. Enable Automated Backups Confirm that BackupRetentionPeriod is set to a value greater than 0. A value of 0 disables automated backups.

4. Review CloudFormation Output After deploying the stack, check the CloudFormation events and logs for any errors or warnings that might indicate issues with the backup configuration.

5. Cross-Region Backup Replication Automated Backup Replication is a relatively new feature, and support may vary based on the RDS engine type and region. Ensure that the target region and KMS key are valid and supported for cross-region backup replication.

6. Test with Manual Changes Since you mentioned that enabling it manually through the RDS console works, compare the configuration in the console with what is defined in your CFT to identify discrepancies.

7. CloudFormation Documentation Refer to the AWS CloudFormation documentation for AWS::RDS::DBInstance to ensure the properties are correctly used.

8. AWS Support If the issue persists, consider contacting AWS support, as there could be underlying issues or limitations not immediately visible in the CFT.

EXPERT
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions