← ~/pillars / cost-engineering / bedrock-cost-attribution
Bedrock cost attribution
Billing-accurate per-developer cost on Amazon Bedrock: IAM principal attribution, session tags through shared roles, the CUR 2.0 columns that carry it, and exactly where attribution breaks.
updated 2026-07-08 ~5 min read pattern 02/07 Cost Engineering
on this page
Context. Layer one gave you real-time, richly attributed estimates. Layer three is the bill. And on AWS, until this year, attributing that bill to people meant wrapping every team in its own tagged inference profile and accepting that per-developer was out of reach. In April 2026 that changed: Bedrock now attributes every inference to the IAM principal that made it, in Cost Explorer and CUR 2.0, with no code changes (announcement, 9 April 2026).
Forces. Billing data is authoritative but coarse: per usage type per day, never per request. Tags are powerful but bureaucratic: they must be activated before they count, and nothing is retroactive. Real fleets put a gateway or a shared role between the developer and Bedrock, which collapses everyone into one identity unless you deliberately pass the person through. And the pricing itself is four-dimensional (input, output, cache read, cache write), so naive reconciliation is wrong before attribution even starts.
Resolution. Let identity attribution carry the who (it is automatic), session tags carry the who through shared roles, inference profiles and Projects carry the what, and invocation logs carry the per-request grain that billing data structurally lacks. The Terraform artifact builds the identity side end to end.
What April 2026 changed
Bedrock records the calling IAM principal (user or assumed role) on every
inference request against the bedrock-runtime APIs (InvokeModel,
Converse, and Chat Completions), and flows it into Cost Explorer and
CUR 2.0 (IAM principal attribution).
Attribution is based on who made the call, not on API parameters: no SDK
changes, no per-team infrastructure. Before this, per-developer dollars
meant one application inference profile per person: profile sprawl nobody
operated happily. Now the profile is an application dimension and the
person comes free.
Two scope notes worth knowing before you design around it: the newer
bedrock-mantle APIs are not yet covered (AWS says support is coming), and
the finest grain is per usage type per day. Per-request cost is
explicitly not what this produces.
Session tags: the person through a shared role
Identity alone distinguishes roles. Most organisations put many developers
behind one federated role, so the interesting dimension arrives via tags,
which come in two flavours: principal tags, attached to the user or role
itself, static; and session tags, passed at AssumeRole time, dynamic
per session. When both define the same key, the session tag wins for that
session. Session tags are the mechanism that makes a shared role
per-developer:
- OIDC federation: the IdP embeds tags in the
https://aws.amazon.com/tagsclaim of the ID token; they land as session tags onAssumeRoleWithWebIdentity. - SAML: map
PrincipalTag:*attributes in the assertion. - Gateways: an LLM gateway assuming its Bedrock role per user passes
Tagsonsts:AssumeRole, with the username inRoleSessionNameso the identity ARN differs per user in invocation logs.
The role’s trust policy must allow sts:TagSession or none of this flows.
One operational trap from the docs: a gateway that re-assumes the role on
every request to vary tags will hit STS rate quotas: assume once per user
and cache the credentials for the session lifetime.
The CUR columns that carry it
In CUR 2.0, principal and session tags appear as columns prefixed
iamPrincipal/{key}; resource tags (inference profiles, Projects) as
resourceTags/{key}
(understanding CUR data).
The spend itself is keyed by line_item_usage_type, which encodes region,
model, token type, service tier, and routing in one string:
| Usage type | Meaning |
|---|---|
USE1-Claude4.6Sonnet-input-tokens | Input tokens, standard tier, in-region |
USE1-Claude4.6Sonnet-cache-read-input-token-count | Cache reads: the cheap ones |
*-cache-write-input-token-count | Cache writes: the premium ones |
USE1-Claude4.6Sonnet-output-tokens-cross-region-global | Output, routed cross-region |
All four token types must be summed for reconciliation. AWS’s own docs flag input-plus-output-only as the most common source of gaps, and agentic workloads are mostly cache reads, so the error is not small. Cross-region routing prices differently from in-region, so the same model can carry two rates in one report.
The activation checklist
Attribution of identity is automatic; attribution of tags is earned through the billing console, and every step is non-retroactive (billing guide):
- Tag the principals (or configure the IdP to send session tags).
- Activate the tags under Cost allocation tags, type IAM principal. They only appear there after the principal has made at least one Bedrock call, and take up to 24 hours to activate.
- Create a new CUR 2.0 data export with Include caller identity (IAM principal) allocation data selected: an export created before the feature existed will never grow the identity columns.
Do this in month zero. Every untagged day is spend you will never attribute.
Where attribution breaks
| Break | Why | Fix |
|---|---|---|
| Gateway shows one identity | Execution role is the caller | Session tags per user; per-user RoleSessionName |
| No per-request cost | CUR aggregates per usage type per day | Invocation logs carry identity.arn per request; join to CUR at model × usage-type grain |
| Session tags missing from invocation logs | Tags bind to the session, logs record the ARN | RoleSessionName per user, or request metadata per call |
| Spend before activation is unattributed | Cost allocation tags are not retroactive | Activate first, adopt second |
bedrock-mantle calls | Not yet supported | Watch the docs; use Projects for that surface |
Worked example: a Claude Code fleet, attributed
A platform team running Claude Code on Bedrock behind IAM Identity Center.
The Terraform artifact
creates the developer role trusting the IdP with sts:TagSession, maps
user, team, and cost_center from IdP attributes to session tags, tags
the role itself as a fallback dimension, and activates the cost allocation
tags. The IdP sends each developer’s email; every Bedrock call any developer
makes is now a CUR line item carrying iamPrincipal/user.
Month one, three queries answer what used to be unanswerable: spend by
developer by day (group by iamPrincipal/user), each team’s token mix
(group by line_item_usage_type, and watch the cache-read share), and the
reconciliation between this and layer one: the OTel estimates from
instrumenting Claude Code
against the CUR truth, joined on user and day. The deltas are normal
(client-side estimates price at list), but a drifting delta means something
changed that only one layer can see, and that is precisely the signal the
three-layer model exists to catch.
// sources
- https://aws.amazon.com/about-aws/whats-new/2026/04/bedrock-iam-cost-allocation/
- https://docs.aws.amazon.com/bedrock/latest/userguide/cost-mgmt-iam-principal-tracking.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/cost-mgmt-understanding-cur-data.html
- https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/iam-principal-cost-allocation.html