If you work with AWS costs, Cost Explorer is usually the first place you go. It shows where the money goes by service, account or region, and how that changes over time.
But some questions need more detail. What each S3 bucket and its API operations cost, how shared EC2 compute is split across ECS services, or which application drives the Parameter Store bill. To answer those, you need the data underneath, that's where Cost and Usage Report (CUR) comes.
CUR is your AWS bill as a table, with one row per line item, per resource, per day or hour. CUR 2.0 is its current version. You deliver it to S3 through AWS Data Exports, then query it with SQL in Athena. That lets you group costs around your own infrastructure and re-run the same analysis whenever you need it.
Let's set it up and work through those three examples.
The examples use CUR 2.0 with resource IDs enabled, and SCAD enabled where required. Replace <database>.<table> with your Athena table and '2026-10' with the billing period you want to query.
Setting up CUR 2.0 with Athena
We'll use AWS Data Exports to create a CUR 2.0 export and make it available in Athena.
The setup is fairly straightforward:
- Open Billing and Cost Management → Data Exports → Create.
- Choose Standard data export → CUR 2.0.
- Enable Include resource IDs. Every example in this post depends on it.
Enable Split cost allocation data if you run ECS or EKS on EC2. Example 2 needs it. Also turn it on under Billing → Cost Management Preferences → Split cost allocation data, because the export setting on its own isn't enough.

Choose Daily granularity and Parquet format, and pick a destination S3 bucket.
- Select the Athena integration. Along with the data, AWS then delivers the setup files for Athena, including a CloudFormation template and the table's SQL definition. Use them to create the table once the first delivery arrives.
Create the export in the payer (management) account if you want every member account in one table. Data starts from the day you create the export, and the first delivery can take up to 24 hours.
Prefer the CLI? The
cur.shscript that accompanies this post is a custom setup: it creates the export with a custom output, then creates the Glue database, an Athena workgroup with a per-query data-scanned limit, and the table with partition projection itself.
Check the script here
A note on the cost metric
For the S3 and Parameter Store examples, we'll use line_item_unblended_cost. Unblended cost is calculated using the unblended rate multiplied by the usage amount.
This is one way to look at the bill, not the only one. Depending on the analysis, you may want to use net unblended or amortized cost instead. The important thing is to understand which metric you're querying and use it consistently when comparing results.
Example 1: Breaking down S3 costs
Imagine an AWS environment with hundreds of S3 buckets. You want to understand which buckets contribute most to the bill, what kind of usage is driving the cost, and how that changes over time.
The following query breaks down one month of S3 cost by account, bucket, category, usage type and operation. Next to each cost it shows the GB-months stored and the number of requests:
SELECT
line_item_usage_account_id AS account_id,
line_item_resource_id AS bucket,
CASE
WHEN line_item_usage_type LIKE '%TimedStorage%' THEN 'storage'
WHEN line_item_usage_type LIKE '%Requests%' THEN 'requests'
WHEN line_item_usage_type LIKE '%Retrieval%' THEN 'retrieval'
WHEN line_item_usage_type LIKE '%EarlyDelete%' THEN 'early delete'
WHEN line_item_usage_type LIKE '%DataTransfer%'
OR line_item_usage_type LIKE '%-Out-Bytes'
OR line_item_usage_type LIKE '%-In-Bytes' THEN 'data transfer'
ELSE 'other'
END AS category,
line_item_usage_type AS usage_type,
line_item_operation AS operation,
ROUND(SUM(line_item_unblended_cost), 2) AS cost,
ROUND(SUM(CASE WHEN pricing_unit = 'GB-Mo'
THEN line_item_usage_amount END), 2) AS stored_gb_month,
CAST(SUM(CASE WHEN pricing_unit = 'Requests'
THEN line_item_usage_amount END) AS BIGINT) AS requests
FROM <database>.<table>
WHERE billing_period = '2026-10'
AND line_item_product_code = 'AmazonS3'
AND line_item_line_item_type = 'Usage'
AND line_item_resource_id <> ''
GROUP BY 1, 2, 3, 4, 5
ORDER BY cost DESC;
What you get from it:
- Bucket and category: whether a bucket's money goes on storage, requests, retrieval or data transfer.
-
Usage type: which storage class.
TimedStorage-ByteHrsis Standard,TimedStorage-SIA-ByteHrsis Standard-IA, and the Glacier tiers have their own types. Usage types start with a region code such asAPS3-orUSE1-. -
stored_gb_monthnext to cost: how much data is stored, not only what it costs. You need both to judge a lifecycle rule. -
Operation: which API calls (
GetObject,PutObject,ListBucket, ...) drive request charges.
Here's what I got (top 5 here)
One limitation: not every S3 charge has a bucket resource ID. This query only includes usage records that can be associated with a bucket
The category matters for what you do next. Lifecycle rules and storage classes reduce storage cost, but they don't reduce request cost. A bucket whose cost is mostly requests needs a change in how the application uses it.
For a trend, add date_trunc('day', line_item_usage_start_date) to the SELECT and GROUP BY, and widen the partition filter to billing_period IN ('2026-09', '2026-10').
Example 2: Allocating shared compute costs to ECS workloads with SCAD
S3 bills each bucket directly. ECS on EC2 doesn't. Consider an ECS cluster where multiple services run on a shared pool of EC2 instances. The EC2 bill tells us how much those instances cost, but it doesn't directly tell us how much compute each ECS service is consuming.
How do we understand the cost of individual workloads when they share the same underlying infrastructure?
This is what Split Cost Allocation Data (SCAD) is for. It isn't a separate tool. It adds extra rows and columns to the same CUR table. For each ECS task (or EKS pod), one row for its CPU and one for its memory, per day (or hour), splitting the cost of the instance it ran on by what the task reserved. The task ARN is in line_item_resource_id and the instance it ran on is in split_line_item_parent_resource_id.
Each task row has two cost columns:
split_line_item_split_cost is the cost allocated to the task for its CPU and memory resources. The allocation is based on split usage, which considers the greater of reserved and actual usage.
split_line_item_unused_cost is the cost of the instance capacity that wasn't utilized, allocated across the workloads.
Add them together for the task's full cost. Across an instance, the two add up to that instance's amortized cost. The split cost on its own won't match your EC2 bill. If your payer has discounts, use the split_line_item_net_* versions of both columns.
The two point to different fixes:
- High unused cost means tasks aren't filling the instances. Look at instance sizes or the cluster's capacity.
-
Reserved far above actual usage means the task itself is oversized. SCAD records both, in
split_line_item_reserved_usageandsplit_line_item_actual_usage. The query below includes them for CPU.
Fargate works a little differently. SCAD also provides task-level CPU and memory usage data for Fargate, but there is no parent EC2 instance to allocate costs from. Fargate costs are already billed per task, so we'll use the regular Fargate line items and task tags to calculate service-level costs.
EC2-backed tasks (from SCAD)
SELECT
line_item_usage_account_id AS account_id,
split_part(line_item_resource_id, '/', 2) AS cluster,
COALESCE(NULLIF(element_at(resource_tags, 'user_service_name'), ''),
NULLIF(element_at(resource_tags, 'aws_ecs_service_name'), ''),
'(untagged)') AS service,
ROUND(SUM(split_line_item_split_cost), 2) AS allocated_cost,
ROUND(SUM(split_line_item_unused_cost), 2) AS idle_cost,
ROUND(SUM(split_line_item_split_cost
+ split_line_item_unused_cost), 2) AS total_cost,
ROUND(SUM(CASE WHEN line_item_usage_type LIKE '%vCPU-Hours'
THEN split_line_item_reserved_usage END), 0) AS reserved_vcpu_hours,
ROUND(SUM(CASE WHEN line_item_usage_type LIKE '%vCPU-Hours'
THEN split_line_item_actual_usage END), 0) AS used_vcpu_hours
FROM <database>.<table>
WHERE billing_period = '2026-10'
AND line_item_product_code = 'AmazonECS' -- SCAD also covers EKS; keep it out
AND COALESCE(split_line_item_parent_resource_id, '') <> ''
GROUP BY 1, 2, 3
ORDER BY total_cost DESC;
Fargate tasks
SELECT
line_item_usage_account_id AS account_id,
split_part(line_item_resource_id, '/', 2) AS cluster,
COALESCE(NULLIF(element_at(resource_tags, 'user_service_name'), ''),
NULLIF(element_at(resource_tags, 'aws_ecs_service_name'), ''),
'(untagged)') AS service,
ROUND(SUM(CASE line_item_line_item_type
WHEN 'SavingsPlanCoveredUsage'
THEN savings_plan_savings_plan_effective_cost
ELSE line_item_unblended_cost
END), 2) AS service_usage_cost
FROM <database>.<table>
WHERE billing_period = '2026-10'
AND line_item_product_code = 'AmazonECS'
AND line_item_usage_type LIKE '%Fargate%'
AND line_item_line_item_type IN ('Usage', 'SavingsPlanCoveredUsage')
GROUP BY 1, 2, 3
ORDER BY service_usage_cost DESC;
The query above takes Usage at its unblended cost plus SavingsPlanCoveredUsage at its effective cost.
Add the two results together, keyed on account, cluster and service, to get the cost per ECS service.
A few things to keep in mind:
-
Use your own tag first.
user_service_nameis an example; replace it with whatever your tasks carry (see the tag-key query above). The queries fall back toaws_ecs_service_name, the tag ECS generates itself, which you activate as a cost allocation tag. Don't rely on the AWS tag alone, because it may cover only some of your tasks. -
Watch the
(untagged)row. It shows how much cost you can't attribute yet. If it's large, add a fallback tag to theCOALESCEor tag those task definitions. - Tags only apply from the day you activate them. Months before activation will show that cost as untagged.
Once you have cost per service, the useful questions are: which services have the highest total cost, which have the largest idle cost, and whether a cluster's idle cost suggests fewer or smaller instances. SCAD won't tell you which instance to remove, but it shows where to look.
Example 3: Finding Parameter Store costs per application service
So far, we've looked at resource-level costs and shared workload costs. But can we take this a step further and understand how much a particular application service is contributing to an AWS service bill?
Some Parameter Store API usage records expose the parameter name in line_item_resource_id. If parameters follow a naming convention such as /conf/<service>/<env>/<key>, we can extract the application service directly from the path.
SELECT
line_item_usage_account_id AS account_id,
regexp_extract(line_item_resource_id, '(?:^|/)conf/([^/]+)/', 1)
AS service,
line_item_operation AS operation,
ROUND(SUM(line_item_unblended_cost), 4) AS cost
FROM <database>.<table>
WHERE billing_period = '2026-10'
AND line_item_product_code = 'AWSSystemsManager'
AND line_item_line_item_type = 'Usage'
AND regexp_like(line_item_resource_id, '(?:^|/)conf/[^/]+/')
GROUP BY 1, 2, 3
ORDER BY cost DESC;
Not all charges are attributable to individual parameters. Batch and path-based API calls, as well as advanced-parameter storage, may lack individual resource IDs.
For Advanced parameters, CUR gives the account total, not the cost per parameter and storage is often the larger part of the bill, so it's worth estimating.
CUR gives an exact price per advanced parameter. Divide storage cost by parameter-hours:
SELECT
ROUND(SUM(line_item_unblended_cost), 2) AS storage_cost,
CAST(SUM(line_item_usage_amount) AS BIGINT) AS parameter_hours,
ROUND(SUM(line_item_unblended_cost)
/ NULLIF(SUM(line_item_usage_amount), 0)
* 24 * MAX(day(last_day_of_month(line_item_usage_start_date))), 4) AS cost_per_param_month
FROM <database>.<table>
WHERE billing_period = '2026-10'
AND line_item_product_code = 'AWSSystemsManager'
AND line_item_operation = 'AdvancedParameterStore'
AND line_item_line_item_type = 'Usage';
Multiply that rate by each application's number of advanced parameters, taken from your deployment config or parameter inventory, to estimate its storage cost. Together with the exact GetParameter cost, this accounts for most of the bill. Report the by-path and batched calls as unattributed rather than spreading them across applications.
If you count parameters with the describe-parameters API, run it sparingly. It shares Parameter Store's API throttle with the calls your applications make at startup.
The same idea works beyond Parameter Store: if resources are named consistently, the names work as a cost dimension.
Making cost analysis repeatable
These examples show how CUR can help answer questions specific to our infrastructure:
Which S3 buckets are driving storage and request costs?
How are shared compute costs distributed across ECS services?
Which application services contribute most to Parameter Store spend?
But the real benefit isn't just running a query once.
Once an analysis is written, we can save and reuse it, change its dimensions, schedule it, or build a dashboard around the results. We can also join billing data with other information, such as service ownership, deployment metadata or internal application mappings. For example, task-level ECS allocation records become much more useful when joined with a service ownership map.
This is where CUR starts becoming more than a way to inspect the bill. It becomes a dataset that can power recurring reports, internal cost dashboards and custom FinOps workflows.
Beyond CUR: Choosing the right AWS cost tool
CUR is one part of the broader AWS cost-management ecosystem. You don't need to build everything yourself, and CUR isn't a replacement for the other tools.
Each tool solves a different part of the cost-management problem. Start with the views and recommendations AWS already provides. Reach for CUR when you need to work directly with the billing records or build analysis around the way your own infrastructure and applications are organized.
There's a lot more to explore once you start working directly with your billing data.





Top comments (0)