Finding Microsoft licences in the Cost and Usage Report
Windows and SQL Server licences are spread across EC2, RDS and Fargate lines in the Cost and Usage Report. These are the operation codes and usage types that identify them, with queries you can run in Athena.
AWS doesn't give you one number for what you pay Microsoft. The licences are billed through EC2, RDS and Fargate, sometimes as their own line and sometimes inside an hourly rate.
The Cost and Usage Report has enough detail to pull them out. The queries below are for Athena over the standard report, where the table is called cur here. Adjust the table name and add a filter on the billing period.
EC2
On a standard licence-included instance there's no licence line. The operation code tells you what the instance was running.
| Operation | What it is |
|---|---|
| RunInstances | Linux |
| RunInstances:0002 | Windows Server |
| RunInstances:0006 | Windows with SQL Server Standard |
| RunInstances:0102 | Windows with SQL Server Enterprise |
| RunInstances:0202 | Windows with SQL Server Web |
| RunInstances:0800 | Windows, bring your own licence |
This query gives instance cost and vCPU-hours for each:
SELECT line_item_operation,
SUM(line_item_unblended_cost) AS cost,
SUM(line_item_usage_amount * CAST(product_vcpu AS double)) AS vcpu_hours
FROM cur
WHERE line_item_product_code = 'AmazonEC2'
AND line_item_usage_type LIKE '%BoxUsage%'
GROUP BY 1
ORDER BY cost DESC;
Multiply the vCPU-hours by the licence rate to get the Microsoft share. In us-east-1 that's $0.046 for Windows, $0.166 for Windows with SQL Server Standard and $0.421 with Enterprise. Burstable t3 instances pay less for Windows than the flat rate, so the estimate runs high for them.
Instances that use Optimize CPUs are billed differently. Their licence is a separate line with the description "Amazon EC2 Optimize CPU License Included Third Party Fees". Search line_item_line_item_description for it.
RDS
On seventh-generation classes and newer, r7i, m7i and later, the licences are their own lines, per vCPU-hour:
SELECT line_item_usage_type,
line_item_operation,
SUM(line_item_usage_amount) AS vcpu_hours,
SUM(line_item_unblended_cost) AS cost
FROM cur
WHERE line_item_usage_type LIKE '%SQLServerLicenseUsage%'
OR line_item_usage_type LIKE '%WindowsOSLicenseUsage%'
GROUP BY 1, 2
ORDER BY cost DESC;
The operation tells you the edition:
| Operation | Edition |
|---|---|
| CreateDBInstance:0011 | SQL Server Web, licence included |
| CreateDBInstance:0012 | SQL Server Standard, licence included |
| CreateDBInstance:0015 | SQL Server Enterprise, licence included |
| CreateDBInstance:0050 | Standard Developer |
| CreateDBInstance:0051 | Enterprise Developer |
| CreateDBInstance:0052 | Standard, bring your own media |
| CreateDBInstance:0053 | Enterprise, bring your own media |
Developer and bring-your-own-media instances have a Windows line and no SQL Server line.
On older classes such as r5, m5 and r6i, the licence is bundled into the instance-hour rate and there's nothing to separate. You can still count the hours by operation to see how much Standard and Enterprise you run.
To list the instances themselves, group by line_item_resource_id:
SELECT line_item_resource_id,
line_item_operation,
SUM(line_item_unblended_cost) AS licence_cost
FROM cur
WHERE line_item_usage_type LIKE '%SQLServerLicenseUsage%'
GROUP BY 1, 2
ORDER BY licence_cost DESC;
Join that to your tags and you have SQL Server licence cost by environment. Anything tagged as test or staging on 0012 or 0015 could run Developer Edition.
Fargate
Windows tasks have a licence line of their own:
SELECT line_item_usage_type,
SUM(line_item_unblended_cost) AS cost
FROM cur
WHERE line_item_usage_type LIKE '%Fargate-Windows%'
GROUP BY 1;
Fargate-Windows-OS-Hours is the licence. The other two lines are the Windows vCPU and memory rates, which are also higher than Linux. The comparison is in Fargate pricing for .NET.
What to do with the totals
Add the three together and compare the result with the total for EC2, RDS and ECS. That ratio is the share of your compute and database bill that goes to licences.
Then split it by environment and by edition. The questions I'd ask of each row are in the other articles: whether the workload needs Windows, whether the database needs Enterprise, and whether it needs all the vCPUs it's licensed for.
Rates above are AWS list prices for us-east-1, on demand, November 2026.
If you've never seen that ratio for your own account, that's where an audit starts.
Short answers
How do I see Windows licence costs in the AWS Cost and Usage Report?
On EC2 the licence is inside the instance rate. Filter instance usage by operation: RunInstances:0002 is Windows, RunInstances is Linux. Multiply Windows vCPU-hours by $0.046 to estimate the licence. On current RDS classes and on Fargate the licence has its own usage type.
What are the EC2 operation codes for SQL Server?
RunInstances:0006 is Windows with SQL Server Standard, RunInstances:0102 is Windows with SQL Server Enterprise and RunInstances:0202 is Windows with SQL Server Web.
Where is the SQL Server licence for RDS in the report?
On seventh-generation and newer instance classes it is a separate line with usage type SQLServerLicenseUsage, billed per vCPU-hour, next to WindowsOSLicenseUsage. On older classes it is bundled into the instance-hour rate.