As organizations scale their AI workloads on Amazon Bedrock, understanding what’s driving spending turns into essential. Groups would possibly have to carry out chargebacks, examine price spikes, and information optimization choices, all of which require price attribution on the workload degree.
With Amazon Bedrock Initiatives, you may attribute inference prices to particular workloads and analyze them in AWS Price Explorer and AWS Knowledge Exports. On this publish, you’ll discover ways to arrange Initiatives end-to-end, from designing a tagging technique to analyzing prices.
How Amazon Bedrock Initiatives and value allocation work
A venture on Amazon Bedrock is a logical boundary that represents a workload, corresponding to an utility, setting, or experiment. To attribute the price of a venture, you connect useful resource tags and move the venture ID in your API calls. You may then activate the price allocation tags in AWS Billing to filter, group, and analyze spend in AWS Price Explorer and AWS Knowledge Exports.
The next diagram illustrates the end-to-end stream:
Determine 1: Finish-to-end price attribution stream with Amazon Bedrock Initiatives
Notes:
- Amazon Bedrock Initiatives assist the OpenAI-compatible APIs: Responses API and Chat Completions API.
- Requests with no venture ID are mechanically related to the default venture in your AWS account.
Stipulations
To comply with together with the steps on this publish, you want:
Outline your tagging technique
The tags that you simply connect to tasks develop into the scale which you can filter and group by in your price experiences. We suggest that you simply plan these earlier than creating your first venture. A typical method is to tag by utility, setting, workforce, and value heart:
| Tag key | Objective | Instance values |
| Utility | 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 steering on constructing a value allocation technique, see Greatest Practices for Tagging AWS Sources. Along with your tagging technique outlined, you’re able to create tasks and begin attributing prices.
Create a venture
Along with your tagging technique and permissions in place, you may create your first venture. Every venture has its personal set of price allocation tags that stream into your billing information. The next instance exhibits how you can create a venture utilizing the Initiatives API.
First, set up the required dependencies:
$ pip3 set up openai requests
Create a venture along with your tag taxonomy:
The OpenAI SDK makes use of the OPENAI_API_KEY setting 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 venture with price allocation tags."""
response = requests.publish(
f"{BASE_URL}/group/tasks",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content material-Sort": "utility/json"
},
json={"identify": identify, "tags": tags}
)
if response.status_code != 200:
elevate Exception(
f"Didn't create venture: {response.status_code} - {response.textual content}"
)
return response.json()
# Create a manufacturing venture with full tag taxonomy
venture = create_project(
identify="CustomerChatbot-Prod",
tags={
"Utility": "CustomerChatbot",
"Setting": "Manufacturing",
"Crew": "CustomerExperience",
"CostCenter": "CC-1001",
"Proprietor": "alice"
}
)
print(f"Created venture: {venture['id']}")
The API returns the venture particulars, together with the venture ID and ARN:
{
"id": "proj_123",
"arn": "arn:aws:bedrock-mantle:::venture/"
}
Save the venture ID. You’ll use it to affiliate inference requests within the subsequent step. The ARN is used for IAM coverage attachment in case you should limit entry to this venture. Repeat this for every workload. The next desk exhibits a pattern venture construction for a corporation with three functions:
| Undertaking identify | Utility | Setting | Crew | Price 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 venture
Along with your tasks created, you may affiliate inference requests by passing the venture 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",
venture="", # ID returned whenever you created the venture
)
response = consumer.responses.create(
mannequin="openai.gpt-oss-120b",
enter="Summarize the important thing findings from our This fall earnings report."
)
print(response.output_text)
To take care of clear price attribution, all the time specify a venture ID in your API calls slightly than counting on the default venture.
Activate price allocation tags
Earlier than your venture tags seem in price experiences, you have to activate them as price allocation tags in AWS Billing. This one-time setup connects your venture tags to the billing pipeline. For extra details about activating price allocation tags, see the AWS Billing documentation.
It may well take as much as 24 hours for tags to propagate to AWS Price Explorer and AWS Knowledge Exports. You may activate your tags instantly after creating your first venture to keep away from gaps in price information.
View venture prices
With tasks created, inference requests tagged, and value 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 experiences.
AWS Price Explorer
AWS Price Explorer gives the quickest approach to visualize your prices by venture. Full the next steps to overview your prices by venture:
- Open the AWS Billing and Price Administration console and select Price Explorer.
- Within the Filters pane, broaden Service and choose Amazon Bedrock.
- Beneath Group by, choose Tag and select your tag key (for instance, Utility).
Determine 2: Price Explorer exhibiting every day Amazon Bedrock spending grouped by the Utility tag
For extra methods to refine your view, see Analyzing your prices and utilization with AWS Price Explorer.
For extra granular evaluation and line-item element along with your venture tags, see Creating Knowledge Exports within the AWS Billing documentation.
Conclusion
With Amazon Bedrock Initiatives, you may attribute prices to particular person workloads and observe spending utilizing the AWS instruments that your group already depends on. As your workloads scale, use the tagging technique and value visibility patterns coated on this publish to keep up accountability throughout groups and functions.
For extra data, see Amazon Bedrock Initiatives documentation and the AWS Price Administration Person Information.
In regards to the authors






