As organizations scale their AI workloads on Amazon Bedrock, understanding what’s driving spending turns into important. Groups may must carry out chargebacks, examine price spikes, and information optimization choices, all of which require price attribution on the workload stage.
With Amazon Bedrock Initiatives, you may attribute inference prices to particular workloads and analyze them in AWS Value Explorer and AWS Knowledge Exports. On this put up, you’ll learn to arrange Initiatives end-to-end, from designing a tagging technique to analyzing prices.
How Amazon Bedrock Initiatives and price allocation work
A undertaking on Amazon Bedrock is a logical boundary that represents a workload, equivalent to an software, surroundings, or experiment. To attribute the price of a undertaking, you connect useful resource tags and go the undertaking ID in your API calls. You may then activate the associated fee allocation tags in AWS Billing to filter, group, and analyze spend in AWS Value Explorer and AWS Knowledge Exports.
The next diagram illustrates the end-to-end circulation:
Determine 1: Finish-to-end price attribution circulation with Amazon Bedrock Initiatives
Notes:
- Amazon Bedrock Initiatives assist the OpenAI-compatible APIs: Responses API and Chat Completions API.
- Requests with no undertaking ID are robotically related to the default undertaking in your AWS account.
Stipulations
To comply with together with the steps on this put up, you want:
Outline your tagging technique
The tags that you simply connect to tasks turn out to be the size you can filter and group by in your price reviews. We advocate that you simply plan these earlier than creating your first undertaking. A standard strategy is to tag by software, surroundings, crew, and price middle:
Tag key
Function
Instance values
Software
Which workload or service
CustomerChatbot, Experiments, DataAnalytics
Setting
Lifecycle stage
Manufacturing, Growth, Staging, Analysis
Crew
Possession
CustomerExperience, PlatformEngineering, DataScience
CostCenter
Finance mapping
CC-1001, CC-2002, CC-3003
For extra steerage on constructing a value allocation technique, see Finest Practices for Tagging AWS Assets. Together with your tagging technique outlined, you’re able to create tasks and begin attributing prices.
Create a undertaking
Together with your tagging technique and permissions in place, you may create your first undertaking. Every undertaking has its personal set of price allocation tags that circulation into your billing information. The next instance exhibits the right way to create a undertaking utilizing the Initiatives API.
First, set up the required dependencies:
$ pip3 set up openai requests
Create a undertaking along with your tag taxonomy:
The OpenAI SDK makes use of the OPENAI_API_KEY surroundings variable. Set this to your Bedrock API key.
import os
import requests
# Configuration
BASE_URL = “https://bedrock-mantle..api.aws/v1”
API_KEY = os.environ.get(“OPENAI_API_KEY”) # Your Amazon Bedrock API key
def create_project(identify: str, tags: dict) -> dict:
“””Create a Bedrock undertaking with price allocation tags.”””
response = requests.put up(
f”{BASE_URL}/group/tasks”,
headers={
“Authorization”: f”Bearer {API_KEY}”,
“Content material-Kind”: “software/json”
},
json={“identify”: identify, “tags”: tags}
)
if response.status_code != 200:
elevate Exception(
f”Didn’t create undertaking: {response.status_code} – {response.textual content}”
)
return response.json()
# Create a manufacturing undertaking with full tag taxonomy
undertaking = create_project(
identify=”CustomerChatbot-Prod”,
tags={
“Software”: “CustomerChatbot”,
“Setting”: “Manufacturing”,
“Crew”: “CustomerExperience”,
“CostCenter”: “CC-1001”,
“Proprietor”: “alice”
}
)
print(f”Created undertaking: {undertaking[‘id’]}”)
The API returns the undertaking particulars, together with the undertaking ID and ARN:
{
“id”: “proj_123”,
“arn”: “arn:aws:bedrock-mantle:::undertaking/”
}
Save the undertaking ID. You’ll use it to affiliate inference requests within the subsequent step. The ARN is used for IAM coverage attachment in the event you should prohibit entry to this undertaking. Repeat this for every workload. The next desk exhibits a pattern undertaking construction for a corporation with three functions:
Challenge identify
Software
Setting
Crew
Value Middle
CustomerChatbot-Prod
CustomerChatbot
Manufacturing
CustomerExperience
CC-1001
CustomerChatbot-Dev
CustomerChatbot
Growth
CustomerExperience
CC-1001
Experiments-Analysis
Experiments
Manufacturing
PlatformEngineering
CC-2002
DataAnalytics-Prod
DataAnalytics
Manufacturing
DataScience
CC-3003
You may create as much as 1,000 tasks per AWS account to suit your group’s wants.
Affiliate inference requests along with your undertaking
Together with your tasks created, you may affiliate inference requests by passing the undertaking ID in your API calls. The next instance makes use of the Responses API:
from openai import OpenAI
consumer = OpenAI(
base_url=”https://bedrock-mantle..api.aws/v1″,
undertaking=””, # ID returned once you created the undertaking
)
response = consumer.responses.create(
mannequin=”openai.gpt-oss-120b”,
enter=”Summarize the important thing findings from our This autumn earnings report.”
)
print(response.output_text)
To keep up clear price attribution, all the time specify a undertaking ID in your API calls somewhat than counting on the default undertaking.
Activate price allocation tags
Earlier than your undertaking tags seem in price reviews, you will need to activate them as price allocation tags in AWS Billing. This one-time setup connects your undertaking tags to the billing pipeline. For extra details about activating price allocation tags, see the AWS Billing documentation.
It will probably take as much as 24 hours for tags to propagate to AWS Value Explorer and AWS Knowledge Exports. You may activate your tags instantly after creating your first undertaking to keep away from gaps in price information.
View undertaking prices
With tasks created, inference requests tagged, and price allocation tags activated, you may see precisely the place your Amazon Bedrock spend goes. Each dimension that you simply outlined in your taxonomy is now out there as a filter or grouping in your AWS Billing price reviews.
AWS Value Explorer
AWS Value Explorer offers the quickest approach to visualize your prices by undertaking. Full the next steps to evaluation your prices by undertaking:
- Open the AWS Billing and Value Administration console and select Value Explorer.
- Within the Filters pane, increase Service and choose Amazon Bedrock.
- Below Group by, choose Tag and select your tag key (for instance, Software).
Determine 2: Value Explorer displaying each day Amazon Bedrock spending grouped by the Software tag
For extra methods to refine your view, see Analyzing your prices and utilization with AWS Value Explorer.
For extra granular evaluation and line-item element along with your undertaking tags, see Creating Knowledge Exports within the AWS Billing documentation.
Conclusion
With Amazon Bedrock Initiatives, you may attribute prices to particular person workloads and monitor spending utilizing the AWS instruments that your group already depends on. As your workloads scale, use the tagging technique and price visibility patterns coated on this put up to keep up accountability throughout groups and functions.
For extra data, see Amazon Bedrock Initiatives documentation and the AWS Value Administration Person Information.
In regards to the authors
Ba’Carri Johnson
Ba’Carri Johnson is a Sr. Technical Product Supervisor on the Amazon Bedrock crew, specializing in price administration and governance for AWS AI. With a background in AI infrastructure, pc science, and technique, she is captivated with product innovation and serving to organizations scale AI responsibly. In her spare time, she enjoys touring and exploring the good outside.
Vadim Omeltchenko
Vadim Omeltchenko is a Sr. Amazon Bedrock Go-to-Market Options Architect who’s captivated with serving to AWS clients innovate within the cloud.
Ajit Mahareddy
Ajit Mahareddy is an skilled Product and Go-To-Market (GTM) chief with over 20 years of expertise in product administration, engineering, and go-to-market. Previous to his present function, Ajit led product administration constructing AI/ML merchandise at main expertise firms, together with Uber, Turing, and eHealth. He’s captivated with advancing generative AI applied sciences and driving real-world influence with generative AI.
Sofian Hamiti
Sofian Hamiti is a expertise chief with over 12 years of expertise constructing AI options, and main high-performing groups to maximise buyer outcomes. He’s passionate in empowering various expertise to drive world influence and obtain their profession aspirations.

