Turn tagged AWS IAM roles into Amazon Bedrock chargeback lines
Monetize generative AI token usage per team or tenant by tagging the AWS IAM roles your workloads already assume. No code changes needed
Amazon Bedrock bills to the account. If you run multiple teams, tenants, or services through a shared account, you cannot tell who consumed what. IAM principal-based cost allocation, launched in April 2026, lets you attribute Amazon Bedrock token costs to the IAM role that made the call. Combine this with the workload identity mechanisms you already use (IRSA, EKS Pod Identity, Amazon ECS Task Roles), and you get per-caller cost visibility in AWS Cost Explorer without custom metering or application code changes.
This article explains the pattern: how to wire the pieces together so that AWS Cost Explorer shows you "Team Platform spent $42 on Amazon Nova Micro last week" with zero application-level instrumentation.
The problem
You have multiple teams or services calling Amazon Bedrock from containers. Today you see one line item: "Amazon Bedrock: $X." You cannot answer:
- Which team is driving the spend?
- Which service is the most expensive per token?
- Who should we charge back for this month's inference costs?
The existing approaches (parsing AWS CloudTrail logs, building custom token counters in application code, or running AWS Cost and Usage Report queries in Amazon Athena) all require significant engineering effort and ongoing maintenance.
The insight
The billing pipeline already knows who made each Amazon Bedrock call. Every
InvokeModel request carries the caller's IAM principal ARN. If that principal (an IAM role) has cost allocation tags, Amazon Bedrock's IAM principal-based cost allocation feature surfaces those tags as dimensions in AWS Cost Explorer.The only thing missing is the link between your workload identity layer (how pods and tasks assume roles) and your cost attribution layer (how billing groups spend). That link is: one tagged IAM role per cost dimension, assumed via your platform's native identity mechanism.
The pattern
┌──────────────────┐ InvokeModel ┌─────────────────┐ ┌──────────────────────────┐│ Amazon EKS / │──────────────▶│ Amazon Bedrock │──────▶│ AWS Cost Explorer ││ Amazon ECS / │ │ │ │ Group by: ││ AWS Lambda │ │ │ │ iamPrincipal/team │└────────┬─────────┘ └─────────────────┘ │ → platform: $42 │ │ │ → ml-team: $128 │ │ assumes via IRSA / └──────────────────────────┘ │ Pod Identity / Task Role ▼┌──────────────────────┐│ AWS IAM Role ││ tags: ││ team=platform ││ product=chatbot │└──────────────────────┘The architecture has three layers:
1. Workload identity (you likely already have this)
Your containers assume AWS IAM roles through the platform's native mechanism:
Compute | Identity Mechanism | How the Pod/Task Gets Credentials |
|---|---|---|
Amazon EKS | IRSA (IAM Roles for Service Accounts) | OIDC federation → AssumeRoleWithWebIdentity |
Amazon EKS | EKS Pod Identity (EKS Pod Identity Agent) | Amazon EKS-managed credential injection |
Amazon ECS | Task Role | Amazon ECS agent injects credentials via task definition |
AWS Lambda | Execution Role | Automatic, one role per function |
2. Tagged roles (the new part)
Each role gets IAM tags that represent your cost dimensions:
-
costType: the billing category (e.g.,interactive,batch,async)
-
product: the product or service name
-
team: the team that owns the workload
The tag key names are up to you. The values are what appear in AWS Cost Explorer. One role per unique combination of values you want to distinguish.
3. Cost allocation activation (one-time setup)
In the management account:
- Tag your IAM roles with your cost dimension keys and values.
- Activate those tag keys as cost allocation tags. This requires management account access (AWS Billing → Cost Allocation Tags → activate).
- Wait. Cost data propagates within 24-48 hours after the first Amazon Bedrock call from a tagged role.
After propagation, in AWS Cost Explorer: Group by → Tag →
iamPrincipal/<your-key> (e.g., iamPrincipal/team ).How granular should you go?
The role-per-X decision depends on what question you need to answer:
Question | Role Granularity | Example |
|---|---|---|
"How much does each team spend on Amazon Bedrock?" | One role per team | bedrock-caller-platform , bedrock-caller-ml-team |
"How much does each service spend?" | One role per service | bedrock-caller-chatbot , bedrock-caller-summarizer |
"How much does each tenant spend?" | One role per tenant | bedrock-caller-tenant-acme , bedrock-caller-tenant-globex |
"All of the above?" | Combine tags on a single role | Tags: team=platform , service=chatbot , tenant=acme |
For most organizations, one role per team or service is the right starting point. Per-tenant roles work for smaller tenant counts (dozens, not thousands. AWS IAM has a 1,000 roles-per-account default limit).
If you want multiple cost dimensions from a single Amazon EKS cluster, create separate Kubernetes ServiceAccounts (and roles) per team or service, each with distinct tag values. For Amazon ECS, use separate task definitions and roles. For AWS Lambda, the function-to-role mapping is already 1:1.
Gotchas
Management account required. Tag activation is a management-account-level action. If your workload account is a member of an AWS Organization, you (or your FinOps team) need management account access to activate the tags. This is a one-time setup, not a recurring operation.
Propagation delay. Tags don't appear in AWS Cost Explorer instantly. Plan for 24-48 hours between "first call from a tagged role" and "data visible in AWS Cost Explorer." This is standard cost allocation behavior, not specific to Amazon Bedrock.
IRSA and session tags. IRSA uses
AssumeRoleWithWebIdentity , which does not support passing STS session tags. Tags must be on the role itself. EKS Pod Identity and Amazon ECS Task Roles do support session tags if you need per-request attribution beyond what role tags provide.From visibility to chargeback
Once AWS Cost Explorer shows per-team or per-tenant Amazon Bedrock spend, the monetization math is straightforward:
- Internal chargeback. Export the AWS Cost Explorer data (CSV or API) monthly, split by
iamPrincipal/team, and allocate to each team's cost center.
- External monetization. If you're reselling AI capabilities to customers (one role per customer), the AWS Cost Explorer data gives you the cost basis. Mark up as your pricing model dictates.
- Budgets and alerts. Create AWS Budgets filtered by
iamPrincipal/teamto alert when a team exceeds their inference budget.
Summary
The pattern is: tag roles → activate tags → read AWS Cost Explorer. The workload identity layer (IRSA, EKS Pod Identity, Amazon ECS Task Role) is just the delivery mechanism that ensures each call carries the right principal. If you already use one-role-per-service (which you should for least-privilege), you likely only need to add three IAM tags and activate them.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article