Amazon Bedrock Integration
Track Amazon Bedrock model costs using the AWS Cost Explorer API.
Overview
Grafient tracks your Amazon Bedrock spending by querying the AWS Cost Explorer API. This captures costs for all Bedrock models - Claude, Llama, Titan, Mistral, and any other model available through Bedrock - broken down by model and token direction (input/output).
Unlike providers with dedicated billing APIs, AWS uses its centralized Cost Explorer service for all cost data. Grafient queries this API daily to pull your Bedrock-specific costs.
Each Cost Explorer API request costs $0.01, charged to your AWS account. With daily syncs, this is approximately $0.30/month. See AWS pricing for details.
Prerequisites
- An AWS account with Amazon Bedrock usage.
- Cost Explorer enabled on your AWS account (see Step 1 below).
- IAM permissions to create users and attach policies.
- A Grafient account on the Free, Pro, or Ultimate plan.
Step 1: Enable Cost Explorer
Cost Explorer must be activated before the API can be used. If you've already used Cost Explorer in the AWS Console, it's likely enabled.
- Go to the AWS Cost Explorer Console.
- If prompted, click Enable Cost Explorer.
- Wait up to 24 hours for data to become available. AWS needs time to process your billing data after activation.
If you skip this step, the integration will fail with an "AccessDeniedException: User not enabled for cost explorer access" error - even if your IAM permissions are correct.
Step 2: Create an IAM User
- Go to the AWS IAM Console.
- Click Users in the sidebar, then Create user.
- Enter a name (e.g.
grafient-reader). - Click Next.
- Select Attach policies directly.
- Search for and attach the following AWS managed policy:
AWSBillingReadOnlyAccess- read-only access to Cost Explorer and billing data
- Click Next, then Create user.
If you prefer a more restrictive custom policy, create one with just the ce:GetCostAndUsage action:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "ce:GetCostAndUsage",
"Resource": "*"
}
]
}
This limits the IAM user to only reading cost data - it cannot access any other AWS services or make changes.
Step 3: Generate Access Keys
- In the IAM Console, click the user you just created.
- Go to the Security credentials tab.
- Under Access keys, click Create access key.
- Select Third-party service as the use case.
- Check the confirmation box and click Next.
- Click Create access key.
- Copy both values - the Access Key ID and Secret Access Key. The secret is only shown once.
Store these credentials securely. The Secret Access Key is only displayed once during creation. If you lose it, you'll need to create a new access key pair.
Step 4: Add the Integration in Grafient
- In Grafient, navigate to Integrations in the sidebar.
- Click Add Integration.
- Select Amazon Bedrock as the provider.
- Enter the Access Key ID from Step 3.
- Enter the Secret Access Key from Step 3.
- Optionally add a label (e.g.
Production - AWS Bedrock). - Click Add Integration to save.
What Happens Next
Once connected, Grafient will:
- Validate your credentials by making a test query to the Cost Explorer API.
- Backfill historical costs - up to 30 days on Free, or 365 days on Pro/Ultimate (AWS Cost Explorer retains 12 months of data).
- Sync daily - an automated sync pulls the latest Bedrock costs.
Costs appear on the Dashboard grouped by model (e.g. Claude 3 Sonnet, Llama 3 70B).
Data Collected
| Data Point | Description |
|---|---|
| Daily cost (USD) | Total Bedrock spend per day, broken down by model |
| Model breakdown | Cost per model, extracted from AWS usage types |
| Token direction | Costs split by input and output tokens where available |
Data Freshness
AWS Cost Explorer data has a 12–24 hour delay. Cost data from today will typically appear tomorrow. This is an AWS limitation - the billing pipeline does not process in real time.
The daily sync captures the latest available data. For the most current view, click Force Sync on your integration card.
Troubleshooting
No cost data after sync
- Check for Bedrock usage: If there has been no Bedrock API usage, there will be no cost data. Verify in the AWS Console under Bedrock > Model access.
- Cost Explorer not enabled: Make sure you've completed Step 1. The API won't work until Cost Explorer is activated, even with the correct IAM permissions.
- Cost Explorer activation delay: If you just activated Cost Explorer, data may take up to 24 hours to appear.
- Try Force Sync: Click the refresh icon on your integration card to trigger a manual sync.
Cost data looks incomplete
- Bedrock only: Only Amazon Bedrock costs are tracked. Other AWS services (EC2, S3, etc.) are excluded.
- Data delay: Due to the 12–24 hour processing delay, yesterday's costs may not have arrived yet.
- On-Demand vs Provisioned: Both on-demand and provisioned throughput costs are captured if they appear under the Amazon Bedrock service in Cost Explorer.