Menu
The New Stack·November 29, 2026

Implementing FinOps for AI/ML Workloads on AWS

This article discusses critical FinOps strategies for managing and attributing AI/ML inference costs on AWS, particularly with services like Bedrock. It highlights the challenges of unpredictable AI model costs and the necessity of robust cost attribution using IAM role tagging and policy enforcement. The core components include SQL queries for identifying untagged spend, OPA/Rego policies for preventing anonymous role creation, and leveraging AWS Budgets for proactive cost control.

Read original on The New Stack

The Challenge of AI Cost Attribution

Managing costs for AI/ML inference, especially with services like AWS Bedrock, presents unique challenges. Unlike traditional compute, AI model usage can be highly unpredictable, with repeated runs of the same task differing significantly in token consumption and cost. This makes forecasting difficult and reactive attribution the primary control mechanism. When multiple AI agents share an IAM role, attributing specific spend to a responsible entity becomes even more complex, akin to a communal corporate credit card without individual accountability. The article emphasizes that FinOps principles are crucial for bringing visibility and control to these emergent costs.

Strategies for Cost Attribution and Control

The article proposes a multi-pronged approach to address AI cost attribution on AWS, focusing on identification, prevention, and proactive budgeting.

  1. Identify Untagged Spend: Using AWS Cost and Usage Reports (CUR 2.0) with caller identity data, SQL queries can identify IAM principals (users/roles) incurring Bedrock costs without proper ownership tags. This retrospective analysis provides visibility into historical spending patterns.
  2. Prevent Anonymous Role Creation: Implement "shift-left" controls using Policy as Code (e.g., OPA/Rego with Terraform plans) to enforce mandatory `owner` tags (with email format validation) on all new IAM roles and users. This ensures accountability from the outset.
  3. Enforce Granular Permissions: Prevent blanket `*` permissions for Bedrock actions on all resources within IAM policies. Policies should scope actions to specific resources or agents to minimize blast radius and ensure least privilege, aiding in cost scoping.
  4. Proactive Budgeting: Once `owner` tags are active as cost allocation tags, AWS Budgets can be configured to alert owners when their assigned roles cross predefined spending thresholds. This provides a crucial proactive control mechanism for unpredictable AI workloads.
  5. Lifecycle Management for Roles: Implement Time-to-Live (TTL) for temporary agent roles to prevent orphaned spend. Roles should be associated with projects and deprovisioned when the project concludes.
💡

Key FinOps Principle

The article highlights that "If neither the task nor the model can say what a run will cost, budgets become aspirational. Attribution after the fact is the only control left." This underscores the importance of granular cost allocation tags and strong governance in dynamic cloud environments, particularly for AI/ML workloads.

Example Rego Policy for IAM Tag Enforcement

rego
deny contains msg if { some rc in resource_changes principal_types[rc.type] writes(rc) not owner_of(rc) msg := sprintf("%s: IAM identity needs an owner tag so its spend has a name", [rc.address]) } deny contains msg if { some rc in resource_changes principal_types[rc.type] writes(rc) o := owner_of(rc) not regex.match(email_pattern, sprintf("%v", [o])) msg := sprintf("%s: owner must be a person's email, got %v", [rc.address, o]) }

This Rego snippet demonstrates how to enforce the presence and format of an `owner` tag on IAM roles and users during Terraform plan evaluation. This policy is critical for integrating cost accountability directly into the CI/CD pipeline, ensuring that resources are properly tagged before deployment.

FinOpsAWSIAMCost ManagementAI/MLGovernancePolicy as CodeTerraform

Comments

Loading comments...