Microsoft Workloads on AWS

Top 10 recommendations to optimize costs with your SQL Server workloads on AWS

The high cost of Microsoft licenses for SQL Server, especially SQL Server Enterprise edition, is a point of concern for many customers planning their migration of SQL Server workloads to AWS. In this blog post, I will discuss 10 things you can do to save money with your SQL Server workloads on AWS.

You have many options to consider when migrating your SQL Server workloads to AWS, each resulting in optimized price/performance, a more intuitive user experience, and a lower total cost of ownership (TCO). You can choose to deploy SQL Server on Amazon Elastic Compute Cloud (Amazon EC2), Amazon Relational Database Service (Amazon RDS) for SQL Server, or use Amazon RDS Custom for SQL Server.

In addition, many of our customers take advantage of our complementary AWS Optimizing and Licensing Assessment (AWS OLA) to build a migration and licensing strategy on AWS. The AWS OLA provides you with a report that models your deployment options using existing licensing entitlements. These results can help you explore available cost savings across our flexible licensing options.

Now let’s get to the 10 recommendations.

1) Consolidate small SQL Server databases.

You can consolidate multiple SQL Server databases into one SQL Server on Amazon EC2 instance or on Amazon RDS for SQL Server.

If you are sizing numerous large SQL Server license included instances, please consider consolidating. As per the Microsoft licensing guide, SQL Server requires a minimum of 4-vCPU licenses per instance. If you consolidate these databases, you can save on licensing costs.

You can make your decision based on the number of databases on the instance, maximum size of database and total size of databases. Consolidation is supported for SQL Server Web, Standard, and Enterprise editions.

AWS does not recommend putting large production databases on one server only. But you can consolidate smaller ones used for development/testing and staging non-production environments. It will depend on your current SQL Server usage; if you have low usage databases, you can consolidate on one server.

You can use Native SQL Server Backup and Restore or Database Migration Services to consolidate. You can read more details about database consolidation.

2) Consolidate multiple instances.

You can also save on SQL Server costs by consolidating multiple instances on one SQL Server EC2 instance. When you first install SQL Server on Amazon EC2, the default SQL Server database instance will be named “MSSQLServer.” You can then create additional named database instances on the same SQL Server EC2 instance.

Each instance of SQL Server will have a unique instance name and a unique port. You can have application-level separation by having separate locations for database data files and separate logins for each instance to meet security requirements. You can share resources such as CPU, memory, and I/O. You should always calculate the required resources based on the real needs of your database. As long as an Amazon EC2 instance running SQL Server has the resources (e.g., CPU and memory) required to run the workload, you can install multiple SQL Server instances and achieve cost savings for a SQL Server deployment.

You can use Native SQL Server Backup and Restore or Database Migration Services to consolidate. To learn more about how to setup multiple instances on Amazon EC2 instance, check out this blog.

3) Select the correct Amazon EC2 instance type.

If you are running SQL Server Standard edition on Amazon EC2 or Amazon RDS for SQL Server with more than 48 vCPUs, consider changing to an instance with 48 vCPUs or less, Why? Because SQL Server Standard edition can only use up to 48 (24 core) vCPUs. Even when you provision an instance with more than 48 vCPUs, the remaining CPUs are not used by SQL Server.

If you are running SQL Server Web edition on more than 32 vCPU instances, AWS also recommends for that you change to 32 vCPUs, the maximum number of vCPUs supported, to help save on costs.

In December 2021, AWS launched three SQL Server recommendations with AWS Trusted Advisor to simplify SQL Server optimization on Amazon EC2. Trusted Advisor now advises customers if they have instances with less than the minimum number of SQL Server licenses.

4) Use SQL Server Developer edition for non-production environments.

SQL Server Developer edition is a free and fully-featured edition. You can download it from the Microsoft website, and it is recommended that SQL Server Developer edition be used for all non-production environments, such as dev, testing, and staging. Customers can run SQL Server Developer edition on Amazon EC2 shared tenancy. It is not supported on Amazon RDS for SQL Server.

To switch from the SQL Server Enterprise or Standard edition to the Developer edition, you can use the native backup/restore method. For bulk deployment, you can use an automation tool.

To learn more, read this blog post: Automating SQL Server Developer deployments for deploying SQL Server Developer Edition on EC2.

5) Optimize CPUs for SQL Server on Amazon EC2.

The Optimize CPUs feature is available with BYOL for SQL Server on Amazon EC2 and provides customers with greater control of their Amazon EC2 instances and helps them save on vCPU-based licensing costs . The first step is to disable hyper threading. You can then specify a custom number of vCPUs when launching new instances, while leveraging the same memory, storage, and bandwidth of a full-sized instance.

For example, a r5d.4xlarge instance currently offers 16 vCPUs by default, but customers can now launch r5d.4xlarge with 4, 6, 8, 10, 12, or 14 vCPUs. This allows BYOL customers to optimize their vCPU-based licensing costs by limiting the number of vCPUs to only the amount needed, saving unnecessary license allocation. Note that CPU-optimized instances will have the same price as full-sized Amazon EC2 instances of the same size.

Customers can save up to 75% of the SQL Server licensing cost with the Optimize vCPUs feature, based on their CPU usage requirement.

6) Switch between SQL Server BYOL and license included instances.

AWS makes it possible to leverage your existing investment in Microsoft licenses through the use of bring your own license (BYOL). BYOL lets customers deploy their existing Microsoft licenses in AWS and only pay for the underlying compute costs. Customers often select the license included (LI) deployment scenario to run SQL Server on AWS to avoid long-term licensing contracts with Microsoft and preserve licensing flexibility for potential future optimization and refactoring.

Customers have the flexibility to change the way they license both Windows Server and SQL Server products on existing Amazon EC2 instances. Customers can temporarily or permanently change the license purchasing options from BYOL to LI or from LI to BYOL associated with their infrastructure by using the new license switching feature. AWS License Manager’s license switching feature allows customers to change license types for SQL Server workloads on Amazon EC2 without having to redeploy their workloads, while retaining the application, instance, and networking configurations.

Please note that Amazon EC2 instances created from AWS AMIs can only leverage the AWS default license included purchasing option. Instances that have been created from AMIs based on your own install media can leverage either the license included or BYOL purchasing options. As a result, you may want to consider using imported AMIs for instances that are not currently leveraging BYOL, but may be candidates for BYOL in the future.

For more information, read the How to convert a license type User Guide and how to save cost using license switching.

7) Switch to R5b instance type.

Customers operating sensitive storage-performance workloads can migrate from an R5 to R5b instance to consolidate their existing workloads into fewer or smaller instances. This can reduce the cost of both infrastructure and licensed commercial software working on those instances. R5b instances are supported by Amazon EC2 and Amazon RDS for SQL Server, simplifying the migration path for large commercial database applications and improving storage performance for current Amazon RDS customers by up to 300%. The R5b instance family offers three times higher IOPS and throughput to Amazon EBS storage compared to other instances in the R5 family. Switch to smaller R5b instances to reduce cost and maintain the same performance. You can save 38% on your existing SQL Server license costs by switching to the R5b family.

To learn more, read the blog post Optimizing cost for high availability SQL Server deployment on AWS.

8) Switch operating system from Windows Server to Linux.

To save on Windows Server licensing costs, customers can switch from SQL Server running on Amazon EC2 for Windows Server to SQL Server running on Linux. Based on price of SQL Server on Windows vs SQL Server on Linux, with SQL Server Standard edition, you can save 20% on licensing, and with SQL Server Web edition, you can save 37%.

For Linux, SQL Server is available to deploy on Red Hat Enterprise Linux (RHEL), SUSE Linux Enterprise Server (SLES), Ubuntu, and Amazon Linux 2. The SQL Server database engine runs the same way on both Windows Server and Linux. However, there are some fundamental changes to certain tasks when using Linux. One key difference between running SQL Server Always On applications on Linux and Windows is related to failover clustering. When you deploy Always On Availability Groups on a Windows Server host, you can take advantage of Windows Server Failover Cluster (WSFC) and Active Directory as built-in features that support failover clustering. However, neither WSFC nor Active Directory are available to support failover clustering on Linux. Instead, to support failover clustering for SQL Server on Linux, the AWS Launch Wizard configures Pacemaker and virtual IP resources for you so that the IP never changes when failover occurs.

To help make the switch, you can use the Windows to Linux replatforming assistant for Microsoft SQL Server Databases.

9) Select the right storage type.

You have different options to store your SQL Server database, including Amazon FSx for Windows File Server or Amazon Elastic Block Store (Amazon EBS). Choose your storage systems based on your workload’s access patterns, and configure them by determining how the workload accesses data. You can use SSD-based volumes, including the highest performance EBS volumes (io2 and io1) for your most demanding transactional applications for SQL Server, and general-purpose SSD volumes (gp3 and gp2) to help balance price and performance. You will want to change your EBS storage type based on your IOPS and throughput requirement. Use the Windows Performance Monitor to get information about IOPS and throughput for your SQL Server database.

To open Windows Performance Monitor, run perfmon at the command prompt. IOPS and throughput data is provided by the following performance counters:

  • IOPS = disk reads/sec + disk writes/sec
  • Throughput = disk read bytes/sec + disk write bytes/sec

I recommend that you get the IOPS and throughput data for peak usage time and also over a typical workload cycle in order to get a good estimate of your requirements. Make sure that the instance type you choose for SQL Server supports these I/O requirements.

10) Select the right high availability architecture.

Customers can also move from a SQL Server Always On Availability Group (AG) architecture pattern to a SQL Server Always On Failover CIuster Instances (FCI) with Amazon FSx for Windows File Server pattern. For AG deployments, you need the SQL Server Enterprise edition license to run AGs; whereas, you only need the SQL Server Standard edition license to run FCIs. This is typically 50–60% less expensive than the Enterprise edition. Although you can run a Basic version of AGs on Standard edition starting from SQL Server 2016, it carries the limitation of supporting only one database per AG.

To learn more, you can read this blog post: Simplify your Microsoft SQL Server high availability deployments using Amazon FSx for Windows File Server.

Conclusion:

In this blog post, I covered 10 recommendations on how to optimize your costs when running SQL Server workloads on AWS. I talked about database and instance consolidation, selecting the right instance, license, and storage types, selecting the right architecture, using the Optimize CPU feature, switching to SQL Server Developer edition, and switching licenses and operating systems..

For more best practices of running SQL Server on AWS, read the SQL Server on EC2 best practices document.


AWS can help you assess how your company can get the most out of cloud. Join the millions of AWS customers that trust us to migrate and modernize their most important applications in the cloud. To learn more on modernizing Windows Server or SQL Server, visit Windows on AWSContact us to start your modernization journey today.

Yogi Barot

Yogi Barot

Yogi is Principal Solutions Architect who has 22 years of experience working with different Microsoft technologies, her specialty is in SQL Server and different database technologies. Yogi has in depth AWS knowledge and expertise in running Microsoft workload on AWS.