- Newest
- Most votes
- Most comments
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/AmazonRDS/latest/UserGuide/USER_ReplicateBackups.html
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.
Relevant content
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 years 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'