Skip to main content

AWS Bedrock Integration

Connect your AWS account to Viio to see what each developer spends on Bedrock. Viio reads a billing export that you publish to your own S3 bucket, and writes nothing back.

Z
Written by Zhenya Shumel

Capabilities

✅ AI usage

Token counts per model and per calling identity, taken from your bill

✅ AI cost

What AWS charged for those tokens, at your own negotiated rates

Prerequisites

  • You must work in the management (payer) account of your AWS Organization. A member account cannot turn on caller identity allocation. To check, compare aws sts get-caller-identity with aws organizations describe-organization --query 'Organization.MasterAccountId'

  • You must be able to create an IAM role and an S3 bucket in that same account

  • Your developers or applications must reach Bedrock through identities Viio can tell apart. Read Who gets attributed below before you start

Who gets attributed

AWS records the caller of every Bedrock request as an IAM principal ARN, and that ARN is all Viio has to work with. How much it tells you depends on how your callers authenticate.

How Bedrock is called

What Viio can show

Developers federate through SSO and the session name is their email

The individual person

A role or user tagged with a team or cost centre

The team, not the individual

One shared role with no per-session identity

Nothing below the AWS account

The usual setup for Claude Code on Bedrock puts the developer's email into the STS session name, so a single shared role still gives you per-person figures. The ARN then looks like arn:aws:sts::123456789012:assumed-role/ClaudeCodeRole/[email protected]. If your credential provider leaves the session name generic, every developer arrives as the same identity, and Viio cannot separate them afterwards.

Setup

  1. Create an S3 bucket for the export, or pick an existing one. Note its name and its region.

  2. Create the CUR 2.0 data export. Create it before the Bedrock usage you want to see. A new export starts from the day you create it. AWS can fill in earlier months, but only if you ask: open a support case from the account that owns the export, naming the export and how many months you want.

    1. Open the AWS console and go to Billing and Cost Management → Data Exports → Create

    2. Choose Standard data export

    3. Export type: CUR 2.0. Viio cannot read a FOCUS export for this integration, because FOCUS has no column for the calling identity

    4. Give the export a name, for example viio-bedrock-usage

    5. Select Include resource IDs. This adds the ARN of the inference profile that was called, and the tags column step 3 needs

    6. Under Additional export content, select Include caller identity (IAM principal) allocation data. Without this the export carries Bedrock cost but no identity, and Viio can attribute nothing

    7. Time granularity: Daily. Hourly multiplies the row count by 24 without adding anything to per-person and per-model totals

    8. Under Data table delivery options, choose Create new data export file. AWS then writes each delivery to its own folder instead of overwriting a file Viio may be reading

    9. Leave Report data integration unselected for both Athena and Redshift. Choosing Athena switches the export to Parquet, which Viio cannot read

    10. Compression type and file format: gzip - text/csv

    11. Choose your bucket and set an S3 path prefix, for example bedrock/cur

    12. Create the export. AWS will ask to add a bucket policy that lets the billing service write to the bucket. Accept it

    The console cannot limit an export to a single service, so this export covers your whole bill. Viio drops the rows for other services as it reads them, so the only cost to you is S3 storage.

    AWS delivers the first file within about 24 hours. Caller identity data takes up to 48 hours to start appearing. After that AWS refreshes the current month about three times a day.

  3. Optional: tag your IAM principals for team attribution. In IAM, tag the users or roles that call Bedrock with whatever matches your organization, for example team or cost-center. Then open Billing and Cost Management → Cost Allocation Tags, filter for IAM principal tags, select yours and choose Activate.

    A tag only appears for activation after that principal has made at least one Bedrock call. Allow up to 24 hours for it to appear and up to another 24 to activate.

  4. Copy your workspace key. In Viio, open Settings → General and copy Workspace (Customer) Key. The next step uses it as the external ID, which AWS checks on every call Viio makes, so no one else can have Viio read your bucket even if they learn your role ARN.

  5. Create a role for Viio to read the export. In IAM → Roles → Create role, choose Custom trust policy and paste this, with your workspace key in place of <your Viio workspace key>:

    {
    "Version": "2012-10-17",
    "Statement": [
    {
    "Effect": "Allow",
    "Principal": { "AWS": "arn:aws:iam::254119104660:root" },
    "Action": "sts:AssumeRole",
    "Condition": {
    "ArnEquals": {
    "aws:PrincipalArn": "arn:aws:iam::254119104660:role/service-accounts/integration-domain/fetcher-aws-bedrock-production"
    },
    "StringEquals": {
    "sts:ExternalId": "<your Viio workspace key>"
    }
    }
    }
    ]
    }

    Attach an inline policy that grants read access to the export only. Replace the bucket name and path prefix with your own:

    {
    "Version": "2012-10-17",
    "Statement": [
    {
    "Effect": "Allow",
    "Action": "s3:ListBucket",
    "Resource": "arn:aws:s3:::my-cost-bucket",
    "Condition": { "StringLike": { "s3:prefix": "bedrock/cur/*" } }
    },
    {
    "Effect": "Allow",
    "Action": "s3:GetObject",
    "Resource": "arn:aws:s3:::my-cost-bucket/bedrock/cur/*"
    }
    ]
    }

    If a customer managed KMS key encrypts the bucket, also grant the role kms:Decrypt on that key.

  6. Configure the integration in Viio:

    1. Open Viio → Integrations and choose AWS Bedrock → Connect

    2. Enter the four values below, then click Continue, add a name, and click Save

      • Role ARN: the role you created in step 5, for example arn:aws:iam::123456789012:role/viio-bedrock-reader.

      • Bucket: the bucket name only, with no s3:// and no path, for example my-cost-bucket.

      • Region: the region the bucket is in, not the region of the export, for example eu-west-1.

      • Export path: the path prefix you set on the export followed by the export's own name, with no bucket name, for example bedrock/cur/viio-bedrock-usage. AWS writes each export into a folder named after it, and this is the folder that holds metadata/.

      There is no external ID field. Viio sends your workspace key as the external ID on every call it makes to AWS, which is what the trust policy in step 5 checks.

    3. Viio checks all four when you save, and names the field that is wrong if it cannot read the export

  7. Initial sync:

    1. Viio reads every billing period already in the bucket

    2. After that Viio picks up each new delivery and replaces that month's figures with the latest ones AWS published

    To confirm AWS has delivered anything yet, list the bucket:

    aws s3 ls s3://my-cost-bucket/bedrock/cur/ --recursive | head

    You should see a manifest under bedrock/cur/viio-bedrock-usage/metadata/billing_period=YYYY-MM/ and a gzipped CSV in a data folder beside it.

Troubleshooting & FAQ

Symptom

Quick fix

Usage appears, but every row says the AWS account rather than a person.

The export is missing the caller identity option, or your callers share one identity. Check in Data Exports that Include caller identity (IAM principal) allocation data is selected. Remember it takes 48 hours to populate, and read Who gets attributed above.

The integration saves but no usage appears.

Usually AWS has not delivered the first file yet, which takes up to 24 hours. Check that Data Exports shows a recent delivery, then confirm there is a metadata/billing_period=YYYY-MM/ folder under your export path. If the export delivers and nothing reaches Viio, the exported periods may contain no Bedrock usage.

I get an access denied error.

Check four things. The role ARN in Viio matches the role you created. The role's trust policy names the Viio principal exactly. The sts:ExternalId in the trust policy matches your Workspace (Customer) Key exactly, including case. The inline policy's bucket name and path prefix match where the export actually writes, including the /* at the end of the s3:GetObject resource.

Viio does not accept my role ARN.

Viio supports the standard AWS partition only. Viio does not accept GovCloud (arn:aws-us-gov:) or China (arn:aws-cn:) role ARNs.

How far back does history go?

A new export starts from the day you create it. To go further back, ask AWS Support to backfill it, giving your account ID, the export name and the number of months. Backfilled months carry the caller identity only where AWS already recorded it, and April 2026 is the earliest that column exists at all.

My per-person costs add up to more than my invoice.

Credits and refunds arrive as their own line items with no calling identity, because a credit cannot be attributed to one caller. Per-person figures are gross cost, before credits.

I use provisioned throughput and see cost but no tokens.

Provisioned throughput bills a flat hourly rate per model unit rather than per token, so the bill carries no token quantity. The cost still appears.

Can I reuse the export I already created for the AWS integration?

No. That one is FOCUS, which has no caller identity column. Create a second, CUR 2.0 export. Both can write to the same bucket under different path prefixes.

Does Viio see our prompts?

No. Viio reads billing data only. Prompts and completions appear in Bedrock model invocation logs. This integration does not touch those logs, and the role cannot read them.

Technical details

  • Authentication: Viio assumes the customer-provided role with sts:AssumeRole, passing your workspace key as the external ID, and assumes it again when the session expires. Viio stores no long-lived credentials from the customer account.

  • Discovery: AWS rewrites one manifest per billing period on every delivery, at <export_path>/metadata/billing_period=YYYY-MM/<name>-Manifest.json. Viio lists those manifests and compares each one's executionId with the one it recorded on the last successful sync. Viio fetches a period only when the two differ, so it never re-reads an unchanged month.

  • Reading: Viio streams the data files from S3 and decompresses them as it reads, so memory does not grow with the size of the export. CUR 2.0 carries 117 columns. Viio keeps the 19 that describe Bedrock usage, discards the rest, and drops other services' rows as it goes. Viio passes money and quantity columns through as the exact decimal strings AWS exported, and parses only the period columns. Viio carries the usage type through unparsed, for example USW2-Claude4.6Sonnet-output-tokens.

Additional resources

Did this answer your question?