Home / Databases / SQL Server

DatabasesHow-toIntermediate

Cutting SQL Server costs on AWS: editions, Optimize CPUs, instance choice, consolidation and Babelfish

SQL Server licences are often the biggest line in an AWS database bill. Covers downgrading Enterprise to Standard where safe, Optimize CPUs on EC2, memory-rich instance types, consolidating instances, Savings Plans and RIs, and when refactoring to Babelfish pays off.

Deepak Bhardwaj2 min read

Applies toSQL Server on Amazon EC2 and Amazon RDS for SQL Server

1. Know where the money goes

For license-included SQL Server, the SQL licence portion of the hourly price is usually larger than the compute. That's why core count — not instance size — is the main lever.

# EC2 instances running SQL Server license-included AMIs (usage operation codes)
aws ec2 describe-instances --query "Reservations[].Instances[].[InstanceId,InstanceType,UsageOperation]" --output table

RunInstances:0102 (Windows + SQL Enterprise), :0006 (Standard), :0202 (Web) — check AWS's billing codes list.

2. Edition review: Enterprise → Standard

Many databases on Enterprise don't use Enterprise-only features.

SELECT feature_name FROM sys.dm_db_persisted_sku_features;   -- run in each database

Empty result = no Enterprise-only features persisted in that database. Also check instance-level needs: memory (> 128 GB buffer pool), cores (> 24), AGs with readable secondaries, online index rebuilds. Standard with Basic AGs or RDS Multi-AZ covers many HA needs.

3. Optimize CPUs (EC2)

Choose instances with lots of memory per core and turn off cores you don't need:

aws ec2 run-instances --instance-type r7i.4xlarge \
  --cpu-options "CoreCount=4,ThreadsPerCore=2" ...

8 vCPUs instead of 16 → half the SQL licence cores, same 128 GB memory. Benchmark first: for memory-bound workloads the difference is small.

Instance families like x2iedn and r7iz are popular for this (high memory or high clock per core).

4. Consolidate

  • Many small instances each with 4-core minimums → fewer, bigger instances (or multiple databases per RDS instance).
  • Check isolation needs (noisy neighbours, maintenance windows, security boundaries) before merging.

5. Commitments

  • Savings Plans / Reserved Instances for EC2 and RDS (RDS RIs apply to the license-included price).
  • BYOL (where your licensing allows) can be cheaper with SA License Mobility — compare with license-included including SA cost.

6. Non-production

  • Developer edition (free) for dev/test on EC2 — never license-included Enterprise for dev.
  • Schedule non-prod instances to stop out of hours (Instance Scheduler on AWS).

7. Refactor where it pays: Babelfish / PostgreSQL

Removing SQL Server entirely (Aurora PostgreSQL + Babelfish, or native PostgreSQL) removes the licence. It pays off for apps you own with moderate T-SQL complexity — see the Babelfish post. Do the cheaper levers above first.

8. Track it

Tag every SQL resource (app, env, edition, licenceModel), use Cost Explorer grouped by usage type, and review monthly.

Tip

Check sys.dm_db_persisted_sku_features across the estate early. Teams are often surprised that most of their "Enterprise" databases could run on Standard, which roughly quarters the licence price per core.