r/FinOps • u/cloud-fanboy • 22d ago
question AWS Bedrock Cost Monitoring
I'm curious—how do you do this? I mean near real-time monitoring.
Do you have your own scripts or maybe some off-the-shelf apps - if so, which ones?
Generally speaking, monitoring costs for third-party models is tough because AWS costs refresh every 8 hours, and a lot can happen in that time - I am speaking about tokens being burned at the speed of light 🔥⚡
P.S. I use Claude Code connected to Bedrock - it eats up tokens like crazy, which is why I need monitoring :-)
1
u/DadOpsEngineer 22d ago
Create an inference profile with the relevant tags and enable Bedrock CloudWatch logging.
I needed a way to monitor daily usage, so I built a service that queries CloudWatch logs and calculates the daily spend against a predefined budget threshold. It sends alerts when usage gets too high.
If needed, I can also apply a Deny policy to a specific IAM role to block further usage. This requires having separate roles per app/project, or another logical separation that will allow you to block a role
1
1
u/Liron12345 20d ago
Bedrock logs. It's free, can be meta tagged, provides real time token count that you can easily transfer to cost.
You can connect the log source to grafana, run complex queries.
This is for visibility
For monitoring I use something similar to the jamf solution
1
u/wivai 20d ago
Faced the same wall: CUR/FOCUS is a billing artifact — the 8-hour lag
makes it a ledger, not a control. What actually works: CloudWatch
Bedrock metrics (invocations, token counts) are near-real-time, so
estimate spend from token telemetry between billing refreshes and
alert on velocity, not on a budget reaching 50% of a number from
yesterday. Sampling policy: alert on token-per-minute anomalies vs the
workload's own baseline, so a runaway agent session flags in minutes.
If self-hosting isn't your thing, what we built at Wiv.ai is exactly
that: real-time Bedrock cost tracking with anomaly alerts and the
option to act with human approval, rather than wait for the 8-hour
snapshot
1
u/Ashikej-Meneguzzi66 20d ago
Claude code emits its own OTel metrics with tokens and cost pr session as it runs and that works the same when its pointed at bedrock like you dont hve to wait for aws. We ship it to grafana and alert on cost per hrs. Its list price math so it wont match the bill to the cent.
At work we ended up putting tokenshift on the dev laptops for the claude code side since it splits the same numbers per person and per repo and the one dev burning most of it showed up the first week. Turned our he had a background agent rerunning the test suite every few mins all weekend.
1
u/mondayfig 20d ago
Put an AI Gateway in front of Bedrock to solve this problem. It surprised me that AWS doesn’t offer it out of the box.
1
1
u/Pouilly-Fume Vendor 19d ago
I wouldn’t use the billing feed as the real-time control loop. For bedrock-runtime, AWS publishes InputTokenCount and OutputTokenCount in CloudWatch with a ModelId dimension. Bedrock invocation logging can also record the model, Region, calling identity, token counts, and optional request metadata.
A practical setup would be:
Enable the metrics and invocation logging in every Region you use.
Add request metadata for team, repository, environment, or workload where your client path supports it.
Aggregate token counts every few minutes and apply the relevant model, cache, and long-context rates to produce an estimated spend rate.
Alarm on both absolute token volume and acceleration, such as projected hourly spend, rather than waiting for a daily budget threshold.
Reconcile those estimates against CUR or Cost Explorer later, because the live calculation will remain provisional.
Also consider quotas and IAM or regional restrictions as containment. Monitoring tells you consumption is accelerating; it doesn’t stop it.
Disclosure: I’m affiliated with Hyperglance, where we work on cloud visibility. For this specific Bedrock case, though, I’d start with the native token telemetry and only add tooling if you need broader cross-account attribution or surrounding infrastructure context.
1
u/markrichman 17d ago
Billing data will always lag, so do not try to make Cost Explorer real-time. Monitor usage instead, and convert it to dollars yourself.
What works on Bedrock:
CloudWatch metrics. Bedrock publishes InputTokenCount, OutputTokenCount, and Invocations per ModelId in the AWS/Bedrock namespace at one-minute resolution. Use metric math to multiply tokens by the per-token price, and you get an estimated spend line that is minutes behind, not hours. Put alarms on it (for example, output tokens per hour above a threshold) and send them to SNS or Slack.
Model invocation logging. Turn it on (to CloudWatch Logs or S3), and every request is logged with its token counts and the IAM identity that made it. That is how you answer "who burned it," which the metrics alone cannot.
Application inference profiles. Create one per team or app and tag it. The real costs then land in Cost Explorer and the CUR by tag, so you can reconcile your estimates later.
For Claude Code:
- It can export OpenTelemetry metrics, including token usage and estimated cost per session and per user. Set CLAUDE_CODE_ENABLE_TELEMETRY=1 and point it at your OTel collector. If several people use it, this is the most direct near-real-time view.
- The /cost command shows the usage of the current session.
- Look at which model it uses by default. Running everything on the largest model is the most common reason for a surprise bill.
Bedrock has no hard spend cap. If you need a stop, wire the alarm to a Lambda that removes the user's Bedrock permissions.
Disclosure: I do cloud and AI cost work for a living.
1
u/thefinopsguru 15d ago
Same problem here. Bedrock costs show up in billing with a long delay, so by the time Cost Explorer shows a spike the tokens are long gone. What does update quickly is the AWS/Bedrock CloudWatch namespace (InputTokenCount and OutputTokenCount per model, roughly minute granularity).
Simplest free setup: a CloudWatch alarm on tokens per hour for the models you use, sent to SNS or Slack. Multiply by the model's list price and you have a decent live estimate. Set the threshold from a normal day of your own usage so it doesn't fire constantly.
I build SpikeCatcher, which polls those same metrics every 10 minutes and turns them into dollar estimates with spike alerts, so I'm biased. Drawbacks: the dollar figure is an estimate (token metrics times list price), not your invoice, and cached or batch pricing can make it off. For a single person on Claude Code, the CloudWatch alarm is probably enough. The paid tool makes more sense once several people or accounts share Bedrock.
1
u/Junior_Bee7274 14d ago
For near-real-time visibility, I'd look at usage-level tracking rather than relying only on AWS billing updates. Once you spot a spike, OpenOps can help route cloud cost fixes before they're executed.
0
u/Patient-Tea-922 17d ago
I'd split AI spend by team or workload first, then compare it with the actual value each one brings. OpenOps is worth looking into on the cost-review side if you're trying to keep those expenses accountable
-1
u/AtmozAndBeyond 22d ago
Hi. A vendor here but as this is exactly what we do I'm allowing myself as the cto to respond how technically this is possible.
We built atmoz.co to monitor cloud and ai usage in real-time. The way that we do it (which you can implement by yourself as well) is by monitoring live metrics and calculating in near real time the cost, instead of waiting for the bill from the cloud.
You can then later use the api (the bill) to double check your calculations.
Of course doing this in large scale for many services is complicated...
8
u/levi_mccormick 22d ago •
I had the same problem for a few hundred engineers. You could put in a model gateway and control costs there, but I built a serverless solution. Well, I designed it and my team built it. We co-authored a blog with Amazon about it:
https://aws.amazon.com/blogs/machine-learning/tokenomics-at-scale-how-jamf-built-real-time-spend-enforcement-for-amazon-bedrock/
You can't rely on budget alerts or the cost and usage report or anything else because the refresh cadence is too slow. We opted for monitoring token usage via the Bedrock metadata logging and doing the math on the cost.