Read time 9 minutes
Amazon Web Services, with its offerings like Amazon RDS, offers a multitude of advantages. It significantly streamlines the processes associated with provisioning, managing, and sustaining on-site relational databases. This service efficiently handles the various tasks involved in overseeing large-scale databases, thereby minimizing the time and effort required for server maintenance.
Amazon RDS lets you create multiple types of relational databases like PostgreSQL, SQL Server, Maria DB, Oracle, MySQL, etc. Amazon RDS will take care of all the maintenance of the database, take a routine backup, and allows the use of the latest version of the selected database application.
The introduction of Native Backup/Restore functionality in SQL Server database empowers users to generate native database backups directly from the RDS instance and save them in an Amazon S3 bucket. When required, these backups can be restored to either an on-premises SQL Server or another RDS instance, providing flexible data recovery options.
With native backup/restore for SQL Server database, the user (DBA) can do the following:
When dealing with Amazon RDS, the approach takes a distinct turn. Instead of depending on the SQL database server’s local file system, the user (DBA) engages with files stored within Amazon S3.
The process of migrating to Amazon RDS follows a different path compared to the typical SQL Server migration. In this method, the user starts by generating a database backup on their local server, then securely stores it on Amazon S3. Finally, the backup is restored to either an existing Amazon RDS DB instance or a new one. The following illustration provides a visual representation of this process.
Source: AWS Documentation
Native backup/restore is made available to all regions of AWS including both Single-AZ & Multi-AZ DB instances and supports all available versions of Microsoft SQL Server.
While Amazon RDS provides numerous advantages and valuable features, it’s essential for users to also familiarize themselves with its limitations and best practices.
Before you can begin utilizing Amazon RDS services, it is essential to establish the groundwork for native backup and restore. This involves setting up an Amazon S3 bucket to store your database backup (BAK) files, configuring the necessary AWS Identity and Identity Access Management role to gain access to the S3 bucket, and adding the SQLSERVER_BACKUP_RESTORE option to the user’s DB instance’s option group. Once you have completed these initial steps, you can then initiate the database migration process to Amazon RDS using the native backup and restore method.
Prior to commencing the migration process, it is essential to confirm that native backup and restore functionality is both enabled and properly configured. To do so, please follow the steps provided below:
Backup SQL Server Database
Use the rds_backup_database stored procedure to back up the SQL Server database.
To call RDS database backup procedure following parameters are necessary:
@source_db_name – Name of the database you want to backup.
@s3_arn_to_backup_to – Amazon S3 bucket you want to use for database backup.
Note: For the second parameter, it’s the combination of two, S3 bucket name + key ARN.
ARN stands for “Amazon Resource Name.”
Following are Optional Parameters
@kms_master_key_arn
@overwrite_S3_backup_file
@type_
Example
Differential Backup Without Encryption
Full Database Backup with Encryption
Check Last Backup or Snapshot Using the given SQL Query
Use the rds_restore_database stored procedure to restore the database.
For restoration, the following parameters are necessary:
@restore_db_name – Database name you want to restore.
@s3_Arn_to_restore_from – ARN prefix of the backup files from which you want to restore the database.
Following are Optional Parameters
@kms_master_key_arn
Database Restore Without Encryption
Database Restore with Encryption
Single Database File Restore
Multiple Database File Restore
Note: Make sure all database backup files have the same prefix, and no other files use it to avoid errors.
Track the Task Status
Call the rds_task_status stored procedure to track the task status.
Note: On calling the stored procedure will return the status of all tasks if no parameter is provided.
Following are Optional Parameters
@db_name
@task_id
Example Query
Note: The task status procedure can return different columns as per the parameter specified.
Using the call procedures given above, you can backup database, restore the database, and track the task status.
But to simplify things to the next level and for the making the database migration to Amazon RDS more easy and fun, we’d suggest using a SQL migration tool.
This sophisticated software simplifies the process of migrating SQL Server databases to both Microsoft Azure SQL and Amazon RDS, regardless of the database size or backup file size. We understand that not all users are operating the most up-to-date version of Microsoft SQL Server. To ensure accessibility for a broad user base, our software is designed to be compatible with a wide range of SQL Server versions available online.
Follow below steps to migrate SQL Server Database to Amazon RDS using the easiest method:
Click on the + icon to expand or – to collapse the object.
To generate live data preview, select the parent or child object by clicking on it, as shown below.
To start the database migration, click on the Migrate button.
You’ve migrated the selected SQL Server database to Amazon RDS successfully. To confirm login to RDS using sign-in credentials and check.
Kernel Migrator for SQL provides users with the capability to access and work with both damaged or intact MDF/NDF/LDF files. As a third-party solution, it simplifies the database migration process, allowing smooth transitions to Microsoft Azure SQL or Amazon RDS.
I used this tool few days back, and I was really happy with the result