Originally published on kuryzhev.cloud
Controlling Bedrock spend per team usually starts the same way: the monthly bill shows one large "Amazon Bedrock" line, three teams share one IAM role, and nobody can say whether the jump came from the support chatbot or a data-science batch job. Someone proposes an AWS Budget, and then discovers that a budget cannot filter on something the bill never recorded.
Short answer: give each team its own tagged application inference profile, activate the tag as a cost allocation tag, and point a tag-filtered AWS Budget at it. For a real cap, attach a budget action that applies an IAM deny policy to the team's role. Use this when several teams share one AWS account; if each team already has its own account, per-account budgets are simpler.
What this actually does
On-demand Bedrock calls made against a foundation model ID carry no team identity. An application inference profile is a resource you create in your account that wraps a model (or a system-defined cross-Region profile) and accepts tags. Callers pass the profile ARN where they would normally pass the model ID, and usage is attributed to that profile.
Three separate mechanisms then do three jobs:
-
Tags on the profile (for example
team=payments) become cost allocation tags once activated in the Billing console. They appear in Cost Explorer and the Cost and Usage Report. - AWS Budgets filters on that tag and notifies at thresholds.
- Budget actions can attach an IAM or SCP policy automatically when a threshold is crossed. This is the only part that enforces anything.
Nothing in this stack is a per-request meter. Billing data arrives with a delay, so the whole design is "stop soon after the limit", not "stop at the limit". Read the current behavior in the Amazon Bedrock documentation and the AWS Budgets guide.
How people use it wrong
The most common failure is tagging the wrong thing. Tagging an IAM role, a Lambda function or an EKS namespace does not tag the Bedrock charge. Cost allocation follows the resource that is billed, so if callers still use the raw model ID, the tag never reaches the bill.
The second is treating a budget as a circuit breaker. A budget with only an email subscriber is an alarm. By the time actual-cost data crosses 100%, a looping agent may have spent well past the limit. Watch out: a forecasted alert fires earlier, but forecasts are weak for spiky token workloads.
Other documented traps:
-
Forgetting to activate the tag. User-defined tags show up as
user:teamin billing only after activation, and data is not guaranteed for periods before activation. Verify backfill options in the Billing documentation. - Filtering the budget by service name. Third-party models can appear under their own service names in Cost Explorer. A filter on "Amazon Bedrock" alone may miss them, so filter on the tag and check the result against Cost Explorer.
-
Leaving the bypass open. If a team's role can still call
bedrock:InvokeModelon the bare foundation model, untagged spend continues and your per-team numbers lie.
The correct approach
First create one profile per team and workload. The command below copies from a system-defined profile. Replace the placeholder with an ARN from aws bedrock list-inference-profiles. The account ID and names are examples.
aws bedrock create-inference-profile \
--inference-profile-name payments-claude-sonnet \
--model-source copyFrom=<system-inference-profile-arn> \
--tags key=team,value=payments key=env,value=prod
# verify: status should be ACTIVE and tags present
aws bedrock get-inference-profile \
--inference-profile-identifier <returned-inferenceProfileArn>
aws bedrock list-tags-for-resource --resource-arn <returned-inferenceProfileArn>
๐งช Lab โ try this in your browser
- LLM Cost Calculator โ Estimate monthly LLM API costs four ways: quick usage inputs, pasted real prompts, prebuilt workload profiles, or prompt-caching savings. One calculator, four modes.
Next, in Billing and Cost Management, activate team under Cost allocation tags. The CLI equivalent is aws ce update-cost-allocation-tags-status --cost-allocation-tags-status TagKey=team,Status=Active. The key must already appear in billing data before it can be activated. Then change the application code to call the profile ARN:
import boto3
br = boto3.client("bedrock-runtime")
resp = br.converse(
modelId="<payments-profile-arn>", # profile ARN, not the model ID
messages=[{"role": "user", "content": [{"text": "ping"}]}],
)
print(resp["usage"]) # inputTokens / outputTokens for this call
Finally, create the budget filtered by the tag. The user:team$payments form is the documented tag filter syntax.
cat > budget.json <<'EOF'
{
"BudgetName": "bedrock-payments-monthly",
"BudgetLimit": {"Amount": "2000", "Unit": "USD"},
"TimeUnit": "MONTHLY",
"BudgetType": "COST",
"CostFilters": {"TagKeyValue": ["user:team$payments"]}
}
EOF
cat > notif.json <<'EOF'
[{"Notification": {"NotificationType": "ACTUAL",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 80, "ThresholdType": "PERCENTAGE"},
"Subscribers": [{"SubscriptionType": "EMAIL",
"Address": "payments-oncall@example.com"}]}]
EOF
aws budgets create-budget --account-id 111122223333 \
--budget file://budget.json \
--notifications-with-subscribers file://notif.json
To verify, run aws budgets describe-budget --account-id 111122223333 --budget-name bedrock-payments-monthly. After the first billing refresh (allow up to a day), open Cost Explorer, group by tag team, and confirm the spend is attributed to payments rather than "No tag key".
Advanced patterns
Make the profile the only door. Give each team role an allow on its own profile ARN. Invoking through an application inference profile also requires permission on the underlying foundation models (in every Region a cross-Region profile covers). So the role cannot simply have no model permissions. Instead, scope the foundation-model allow so it only applies when the request comes through the team's profile. The Bedrock IAM examples use an inference-profile condition key such as bedrock:InferenceProfileArn for this.
A plain deny on bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream against foundation-model resources would also block profile calls, because the model ARN is evaluated too. Any permissions boundary or SCP that closes the bypass must use that condition. Confirm the exact condition keys and resource list in the Service Authorization Reference before relying on them.
Turn the alarm into a brake. A budget action can attach a deny policy to the team role at 100% of actual cost. Use manual approval first, then switch to automatic once you trust the numbers.
There is no separate IAM action for the Converse API. Converse is authorized by bedrock:InvokeModel and ConverseStream by bedrock:InvokeModelWithResponseStream, so bedrock:InvokeModel* covers both. Batch inference jobs are started with bedrock:CreateModelInvocationJob and need their own deny.
# deny policy (managed policy "bedrock-team-freeze") contains:
# {"Version":"2012-10-17","Statement":[{"Effect":"Deny",
# "Action":["bedrock:InvokeModel*","bedrock:CreateModelInvocationJob"],
# "Resource":"*"}]}
aws budgets create-budget-action \
--account-id 111122223333 \
--budget-name bedrock-payments-monthly \
--notification-type ACTUAL \
--action-type APPLY_IAM_POLICY \
--action-threshold ActionThresholdValue=100,ActionThresholdType=PERCENTAGE \
--definition 'IamActionDefinition={PolicyArn=arn:aws:iam::111122223333:policy/bedrock-team-freeze,Roles=[payments-app-role]}' \
--execution-role-arn arn:aws:iam::111122223333:role/budgets-action-role \
--approval-model MANUAL \
--subscribers SubscriptionType=EMAIL,Address=finops@example.com
Watch out: a freeze policy on a production role is an outage you scheduled yourself. Cap dev and batch roles automatically. For customer-facing paths, page a human instead, or set a lower soft limit and a higher hard limit.
For a faster signal than billing, alarm on the AWS/Bedrock CloudWatch token metrics (InputTokenCount, OutputTokenCount) and convert tokens to dollars with your model's price. Verify in your account which dimension value identifies a profile. This is an estimate, not an invoice. More platform patterns like this live on kuryzhev.cloud.
Performance notes
Calling through an application inference profile is documented as a routing and attribution layer, and no per-call latency penalty is documented. Measure p50 and p95 on your own prompts before and after the switch rather than assuming either way.
The delays that matter are administrative:
- Tag visibility: up to roughly a day after activation or first usage.
- Budget evaluation: follows billing data refreshes, documented as up to three times a day and typically lagging usage by hours. It is never per request.
- Overshoot: a busy agent fleet can spend meaningfully past the limit before the action fires. Set the hard threshold below what you can tolerate, such as 80-90% of the real ceiling.
Throttling is not isolated by profile. Application inference profiles share the underlying model's service quotas, which apply per model and Region at account level. One team's batch job can therefore still throttle another team's interactive traffic. If that matters, move the noisy team to a separate account or use provisioned throughput for the latency-sensitive path.
This approach has costs:
- More resources to manage (profiles per team, per environment).
- A cost-allocation-tag activation step that Terraform may not cover in your provider version.
- Coupling to AWS-specific tagging.
Skip it if one team owns the whole account, or if you already route all calls through an LLM gateway that meters tokens per key. In that case, enforce limits there and use the tags only for reconciliation.
Top comments (0)