Articles on websites & etc.

§ Home > Index > Web Development

How To Restore a SQL Server BAK file to Amazon RDS

This article describes how to restore a SQL Server database backup file (.bak) to a SQL Server database hosted on Amazon's Relation Database Service (RDS).

Amazon RDS for SQL Server does not allow you to restore a .bak file (as of Apr. 2013). If you attempt to use the Restore Database... function and select a File (Device) to be restored, you will get an error saying Failed to retrieve data for this request. Amazon has disabled this function.

The official Amazon documentation describes how to Import Data Into SQLServer on Amazon RDS using a convoluted and lengthy procedure.

To solve the issue, you can use the free SQL Azure Migration Wizard (available from CodePlex). This high-quality tool is by Amazon RDS's cloud database competitor, Microsoft SQL Azure, and it allows you to migrate databases between servers.

Steps to Restore .bak SQL Server backup file to Amazon RDS

  1. Launch a Windows + SQL Server Amazon EC2 on-demand instance. (Use the same availability zone as your Amazon RDS instance to speed up the data transfers.) Make sure to increase the default size of the EBS volume to accomodate 3-4 times the space occupied by the .bak file. You'll need space to store the .bak file, the restored database MDF/LDF, and the scripts generated for the migration. You can also create a separate EBS volume.
  2. Zip your .bak file and upload it to this new instance
  3. To transfer the file securely, you can copy/paste it via remote desktop.
  4. Another way is to install FileZilla FTP Server
  5. and set up FTP over SSL. Then, use WinSCP FTP client software to upload the file there (with resume capability). Both of these are freeware.
  6. Restore the .bak file into the SQL server database local to that Amazon EC2 instance
  7. Install and run the SQL Azure Migration tool.
  8. Select the source database as the local server
  9. Select Analyze/Migrate > SQL Database
  10. Generate scripts (Edit the .xml config file in the SQL Azure folder if you need to change the location where the scripts are generated. They can get large!)
  11. Select the destination server as "SQL Server" type and enter the RDS hostname / endpoint.
  12. Run the scripts on the destination server
  13. Save the RTF log files for troubleshooting

The above procedure is a quick and painless way to retore your SQL Server .bak backup files into an Amazon RDS instance.


AWS RDS SQL Server vs. SQL Azure Smackdown – Importing Data - a short video showing how to use the Migration tool to import or load data into SQL Server on Amazon RDS.

Have you heard of the new, free Automated Feeds offered by Google Merchant Center? Learn more in Aten Software's latest blog post comparing them to traditional data feed files.
Created 2013-04-12, Last Modified 2016-12-01, © Shailesh N. Humbad
Disclaimer: This content is provided as-is. The information may be incorrect.