Migrate a SQL Server Database to the Cloud
Migrating a SQL Server database to the cloud is similar to migrating a database to a new server. The cloud can simplify the process through the use of managed services such as AWS Lightsail.
Module 1: Setting Up a Working Environment
Step 1: Create a Cloud9 Environment
Step 2: Configure the Environment with Tools
Module 2: Create a SQL Server Instance from a Lightsail Blueprint
Module 3: Create Storage for Data and Log Files
Step 2: Attach Block Storage to the Database Server
Module 4: Configure the SQL Server VPS
Step 1: Find the Disk Number of the Unformatted-But-Attached Disk
Step 2: Download the Wide World Importers Sample Database
Step 3: Create Directories for Data Files and Logs
Module 5: Restore the Database from the Backup File
Info | |
---|---|
✅ AWS Level | 200 - Intermediate |
⏱ Time to complete | 45 minutes |
💰 Cost to complete | Free when using the AWS Free Tier or USD 1.01 |
🧩 Prerequisites | - An AWS account: If you don't have an account, follow the Setting Up Your AWS Environment tutorial for a quick overview. For a quick overview for creating account follow Create Your AWS Account. - AWS credentials: Follow the instructions in Access Your Security Credentials to get your AWS credentials - A git client: Follow the instructions to Install Git for your operating system. |
💻 Code Sample | Code sample used in tutorial on GitHub |
📢 Feedback | Any feedback, issues, or just a 👍 / 👎 ? |
⏰ Last Updated | 2023-08-09 |
- How to create a browser-based environment for working with cloud resources
- How to create storage and attach it to a database server
- How to deploy and configure SQL Server with a Lightsail blueprint
- How to restore a MS SQL database on a Windows Server VPS





Tip: Cloud9 is a full-featured IDE and you can save command snippets and scripts in a code repository like Github or Gitlab. Cloud9 includes Git Panel for managing repositories. An advantage of using a code repository is that it is available anywhere and you can use it to manage snippets and scripts for reuse.
aws lightsail get-blueprints
command. The get-blueprints
command lists all the blueprints available; you can find a specific blueprint by piping the output of the command to the unix grep utility.windows_server_2022_sql_2022_express
. Create a VPS with with this blueprint. In addition, the --user-data
parameter creates a directory to store the back SQL Server backup file. The --bundle-id
sets the size of the server.aws lightsail create-disk
command. Name the disk and set the availability zone.Note: The RDP button may take 5-to-7 minutes before it becomes active and you can connect to the server.

Get-Disk
commandlet to find the unformatted disk, which is attached but offline.New-Partition
commandlet. The commandlet also assigns a drive letter and use the entire disk.sqlcmd
utility lets you use T-SQL commands against SQL Server. Save the following script to a file in the C:\backup directory and name it restore_database.sql
, use notepad or an editor of your choice.sqlcmd
.




Website.Customers
view.



sqlserver-data-and-logs
. Choose Delete.

pcg-database
and select Delete.
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.