AWS Database Blog

Restore an Amazon RDS Custom for SQL Server instance using a backup from AWS Backup

Amazon Relational Database Service (Amazon RDS) Custom for SQL Server gives you the flexibility to customize your database environment while maintaining the benefits of a managed service. You have an option to bring your own licensed SQL Server media or use SQL Server Developer Edition, all while leveraging the time savings, durability, and scalability that come with a managed database service

AWS Backup supports the creation of on-demand backups of RDS Custom for SQL Server instances. However, the restoration of RDS Custom for SQL Server instances through AWS Backup is not natively supported at the time of writing this post. Nonetheless, this post presents a workaround solution that enables the successful restoration of RDS Custom for SQL Server instances using AWS Backup-created backups. This solution operates by first creating backups through AWS Backup, which appear as snapshots with an ‘awsbackup’ prefix in the Amazon RDS console, and then utilizing these snapshots with restore-db-instance-from-db-snapshot operation. This solution is particularly valuable for organizations that need to comply with long-term data retention policies, as it extends backup retention beyond the standard 35-day limit of Amazon RDS automated backups through configurable AWS Backup vault settings.

Solution overview

This post outlines the process for restoring an RDS Custom for SQL Server instance using a backup created by AWS Backup. You can implement the solution using either the Amazon RDS console or AWS Command Line Interface (AWS CLI) with restore-db-instance-from-db-snapshot. The complete procedure involves the following steps:

  1. Enable AWS Backup for Amazon RDS.
  2. Create an on-demand backup of an RDS Custom for SQL Server instance using AWS Backup.
  3. Restore the RDS Custom for SQL Server instance using the backup.

Prerequisites

Before you implement this solution, ensure you have the following prerequisites:

Enable AWS Backup for Amazon RDS

Complete the following steps to enable AWS Backup for Amazon RDS:

  1. On the AWS Backup console, choose Settings under My account in the navigation pane.
  2. Choose Configure resources.
  3. On the Configure resources page, locate the RDS resource type and enable it.
  4. Choose Confirm to save your configuration changes.

Create an on-demand backup of an RDS Custom for SQL Server instance

Complete the following steps to take an on-demand backup of an RDS Custom for SQL Server instance using AWS Backup:

  1. On the AWS Backup console, choose Protected resources under My account in the navigation pane.
  2. Choose Create an on-demand backup.
  3. For Resource type, choose the resource type that you want to back up. For example, choose RDS for Amazon RDS.
  4. For Database name, choose your RDS Custom for SQL Server instance (for example, rds-cfs-instance).
  5. For Backup window, select Create backup now. This setting enables the immediate creation of a backup, rather than scheduling the job for a later time.
  6. For Total retention period, specify the desired retention duration (for example, choose Forever for indefinite retention). AWS Backup automatically manages deletion based on your retention settings.
  7. For Backup vault, choose an existing vault (such as Default vault) or create a new AWS Backup vault if required.Choosing Create new Backup vault opens a new page to create a vault and then returns you to the Create on-demand backup page when you are finished.
  8. For IAM role, select Default role for AWS Backup to use for this operation.
  9. Choose Create on-demand backup.

You will be redirected to the Jobs page, where you can monitor the progress of your backup job.

Alternatively, you can initiate this backup operation using the AWS CLI command start-backup-job:

aws backup start-backup-job --backup-vault-name default \
--resource-arn arn:aws:rds:<region>:<account-id>:db:instance-name \
--iam-role-arn arn:aws:iam::<account-id>:role/service-role/AWSBackupDefaultServiceRole \
--lifecycle DeleteAfterDays=<Number of days> --region <region_name>
Bash

Monitor backup progress

From the Jobs page of the AWS Backup console, select the backup job ID associated with your RDS Custom for SQL Server instance. The detailed view allows you to:

  • View the backup job ID
  • Check the status of your backup
  • Monitor for warnings or errors

The backup job details page provides important information such as creation time and resource details that you might need for future reference or troubleshooting.

Restore the RDS Custom for SQL Server instance using the backup

Backups created by AWS Backup are also visible on the Snapshots page of the Amazon RDS console, on the Backup Service tab. These backups can be identified by their unique AWS Backup job identifier prefix awsbackup:job-XXXXXXXXXX-*.

To perform a snapshot restore, complete the following steps:

  1. On the Amazon RDS console, choose Snapshots in the navigation pane.
  2. On the Backup service snapshots tab, select the snapshot (awsbackup:job-XXXXXXXXXX-b0c71179dfd9).
  3. On the Actions menu, choose Restore snapshot.
  4. To initiate the snapshot restore operation, you must provide several required input parameters. These typically include the target instance identifier, instance class, storage type, and network settings.
  5. After specifying these parameters, initiate the restore process.

Upon completion, a new RDS Custom for SQL Server instance (such as snapshot-restore-for-cfs-instance) will be created based on the selected AWS Backup snapshot awsbackup:job-XXXXXXXXXX-b0c71179dfd9.

Alternatively, you can initiate the restore operation using the AWS CLI command restore-db-instance-from-db-snapshot:

aws rds restore-db-instance-from-db-snapshot --region <region-name> \
--db-instance-identifier snapshot-restore-for-cfs-instance \
--db-snapshot-identifier awsbackup:job-XXXXXXXXXX-b0c71179dfd9 \
--db-subnet-group-name rds-cfs-db-subnet-group \
--storage-type gp2 \
--custom-iam-instance-profile AWSRDSCustom-iam-instance-profile \
--vpc-security-group-ids sg-XXXXXXXX \
--no-multi-az
Bash

Clean up

If you no longer need your RDS Custom for SQL Server instance, it is recommended to delete the instance to avoid incurring additional costs. Complete the following steps to clean up your resources:

Conclusion

In this post, we’ve demonstrated how to leverage AWS Backup to create on-demand backups of RDS Custom for SQL Server instances and use those backups to perform snapshot restores. This solution enables you to extend your backup retention beyond the standard 35-day limit, helping you meet long-term compliance requirements while maintaining the benefits of a managed database service. By combining the flexibility of RDS Custom with the powerful features of AWS Backup, you can create a robust, customizable backup strategy that aligns with your specific business needs. We encourage you to implement this solution in your environment and explore how it can enhance your data protection and retention capabilities.

Try out the solution for your use case, and share your feedback in the comments.

About the authors

Srikanth Katakam

Srikanth Katakam

Srikanth is a Senior Database Engineer at AWS, specialized in Amazon RDS commercial database engines such as Amazon RDS managed and Amazon RDS Custom for SQL Server. With a wealth of technical expertise, Srikanth is passionate about designing and developing robust features that serve the diverse needs of AWS customers. He thrives on creating database solutions that effectively tackle complex technical challenges and providing customers with access to reliable and efficient database services.

Binod Bhandari

Binod Bhandari

Binod is a Senior Software Development Engineer, focusing on Amazon RDS and commercial databases, particularly SQL Server. He is driven by the opportunity to solve intricate technical problems and create database solutions that elevate the customer experience for Amazon RDS and Amazon RDS Custom for SQL Server customers.