SQL Server Web on Ubuntu saves 41% over the Windows license. RHEL is a bit more but still a solid savings. If you’re using RHEL, you probably have your reasons and are willing to pay the premium. RDS was included for contrast, as it costs 27% more than the Windows AMI. Of course, RDS includes other features that aren’t included in the AMI. As a general rule, I steer people toward RDS, but in my opinion, the best features of RDS are in Aurora, which doesn’t support any flavor of SQL Server.
Other reasons to switch to SQL Server on Linux include:
- SQL Server can run in a Linux docker container, enabling lighter weight CI/CD pipelines and local development patterns.
- The Linux install of SQL Server is straightforward using apt-get and dnf package managers. All steps can be fully automated using an unattended install script, if you need to do so.
In our case, we had a customer running in GovCloud. While SQL Server on Linux AMIs are available in GovCloud, they are previous versions of both the OS and SQL Server. We opted to use Ubuntu, deployed via Terraform, with a shell script install for SQL Server.
Restoring Data from Backup
The backups for restore to the Linux SQL Server instance were kept in S3. SQL Server allows backup directly to and from S3 using the FROM URL = ‘s3://bucket/db.bak’ syntax, but this requires setting up credentials inside the SQL Server. I didn’t want to generate keys, so I leveraged the IAM instance profile to pull the backups down to local using the aws s3 cp s3://bucket/db.bak /tmp/, then restore using FROM DISK = ‘/var/dbname.bak’.
SQL Server backups employ the concept of a logical file. The restore process expects the target filesystem to be identical to the paths in the source system. If you restore to a different filesystem path, the restore will fail.
You can identify the logical file names using this query:
RESTORE FILELISTONLY
FROM DISK = ‘/tmp/dbname.bak’
GO
Note the following fields in the output: