Split Shared API Costs Across Teams Using Usage Metrics
Allocate untagged or shared API costs to teams based on usage data, from connecting an external metric to a reusable chargeback model in Costory.
When part of your cloud bill is untagged, for example a shared API gateway used by several teams, tags alone can’t attribute it. Without , those costs land in an “other” bucket, and chargeback or showback becomes impossible.This guide splits shared API costs proportionally. You connect an external usage metric (API call counts per team) in Costory, then build a reusable that attributes the right share of cost to each team going forward.
You have identified the total cost of this API in your billing data.
You have a usage metric from your internal monitoring tool (e.g., API call counts per team) that can serve as an allocation key to split costs across callers.
In this example, you will use an AWS S3 Parquet file that looks like:
date
team
region
api_call_count
2025-12-01 00:00:00
Team_A
North
1081
2025-12-01 00:00:00
Team_A
South
1330
2025-12-01 00:00:00
Team_A
East
1201
2025-12-01 00:00:00
Team_A
West
505
2025-12-01 00:00:00
Team_B
North
983
For each team and region, you know how many API calls were made.
This use case uses an AWS S3 Parquet file, but you can use any source on the External metric grid: Datadog, Datadog CI Visibility, Amplitude, BigQuery, Google Sheets, Tsuga, CloudWatch, or S3.
The overall flow is: export a usage metric from your monitoring system, import it into Costory, preview the proportional split, then lock it in with a Virtual Dimension.
Create an IAM role with READ and LIST permissions on this bucket
Add a federated trust policy so the Costory service account can assume the role
Attach the read policy to the role
2
Schedule the metric export
Create a scheduled job (cron, Airflow, GitHub Actions, or any orchestrator) that writes the metric file to the bucket every day. The job should:
Output format: A Parquet file with one row per combination of dimensions per day. At minimum, include a date column, one or more dimension columns (e.g., team, region), and a numeric value column (e.g., api_call_count).
S3 prefix: Write files under a consistent prefix, for example s3://<bucket>/api_cost_allocations/. Costory scans this prefix for new files.
Overwrite strategy: You can safely write a new file each day. Costory applies an incremental overwrite strategy: for a given day, the last data received wins, and existing data for other days is preserved.
You can force a re-import on demand from the Metrics DataSource page. Otherwise, files are imported automatically every day at 06:00 UTC.
3
Create the metric in Costory
Terraform
Manual
# Add this to the same Terraform configuration as the previous step.resource "costory_metrics_datasource_s3_parquet" "single_dims" { name = "API Usage" bucket_name = local.bucket_name prefix = "api_cost_allocations" role_arn = aws_iam_role.federated.arn metrics_definition = [ { metric_name = "API Usage" gap_filling = "ZERO" // How to handle missing values for a day aggregation = "SUM" // How to aggregate the metric across multiple days value_column = "api_call_count" date_column = "date" dimensions = ["region", "team"] unit = "calls" } ]}
Go to the Metrics DataSource Page and create a new metric.
Select the S3 bucket and the file name.
Select the column that contains the date.
Select the column that contains the team.
Select the column that contains the region.
Select the column that contains the API call count.
Save the metric.
The metric will take a few minutes to be ingested. Once ready, you can see it and its values in Costory.
The Metrics Datasources page showing the imported API Usage metric as Active
4
Preview the reallocation
Use Explorer to preview how the reallocated costs would look before committing to a virtual dimension.The idea is to build a formula that computes each team’s proportional share of the total API cost:
Row
What it represents
Example
a
API Usage metric, grouped by team
Team A: 4 117 calls, Team B: 983 calls
b
Total API usage across all teams
5 100 calls
c
The reallocation formula: a / b * d
Team A gets 80.7% of the cost
d
Total cost of the shared API resource
$1 000
The formula a / b * d gives you: (team’s calls / total calls) * total cost = team’s share.
Explorer showing the reallocation formula: team usage (a) / total usage (b) * total cost (d)
5
Create the Virtual Dimension
Create a virtual dimension that automatically allocates the shared cost going forward.
Add a new rule for those API costs:
Rely on reallocation based on usage metrics
Use the metric you just imported
Choose an allocation strategy:
Identity mapping: The new label value is the team name
Regex mapping: The API name contains the team name (extract it with a regex)
Manual mapping: The API name has no relation to the team name; map each name manually
Save the virtual dimension
Watch how a Virtual Dimension rule is configured with dynamic allocation based on the imported usage metric:
Creating a Virtual Dimension rule that dynamically allocates API costs based on the imported usage metric
Prefer to skip the UI? The Costory MCP can draft, preview, and publish this reallocation virtual dimension from chat. Try “draft a virtual dimension that splits my API gateway cost across teams using the API Usage metric, then show me the preview.”
Set up a weekly Slack report to share the reallocated costs with each team automatically.
Explore the results in Explorer to validate cost attribution per team.
Build on this allocation to create a budget tracking workflow per team.
Last modified on November 12, 2026
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Costory Documentation","colors":{"primary":"#1D3C93","light":"#305DD9","dark":"#1D3C93"},"logo":{"light":"https://mintcdn.com/costory/jdghijjvsrOsYiTC/logo/light.png?fit=max\u0026auto=format\u0026n=jdghijjvsrOsYiTC\u0026q=85\u0026s=dee63acdba91bf952855557cc5c5ec16","dark":"https://mintcdn.com/costory/jdghijjvsrOsYiTC/logo/light.png?fit=max\u0026auto=format\u0026n=jdghijjvsrOsYiTC\u0026q=85\u0026s=dee63acdba91bf952855557cc5c5ec16","href":"https://costory.io"},"favicon":"https://mintcdn.com/costory/stODLWETeKeyz7ed/favicon-new.svg?fit=max\u0026auto=format\u0026n=stODLWETeKeyz7ed\u0026q=85\u0026s=334ff5307103e4ffc0473bb6e1b9b56c","appearance":{"default":"light","strict":true},"navbar":{"links":[{"href":"https://costory.io","label":"Website"}],"primary":{"type":"button","label":"Start 30-day free trial","href":"https://app.costory.io/welcome-demo?utm_source=docs\u0026utm_content=nav\u0026cta=docs-nav"}},"integrations":{"posthog":{"apiKey":"phc_jgU0iQbU4Arfu5ouKpn9YhzkTWv3P5VfW2n7sJsKR0P","apiHost":"https://user.costory.io","sessionRecording":true}},"contextual":{"options":["copy","view","chatgpt","claude","aistudio"],"display":"header"},"metadata":{"timestamp":true},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"costory","hasAudioNarration":false,"actualSubdomain":"costory","customDomains":["docs.costory.io"],"gitSource":{"type":"github","owner":"costory-io","repo":"mintlify-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6af59b1f51057243856fa6bc","clientVersion":"0.0.4111","searchFilterCounts":[{"language":"default","tag":"API Reference","count":124},{"language":"default","tag":"Documentation","count":74},{"language":"default","tag":"Setup","count":47},{"language":"default","tag":"Alerts V2","count":26},{"language":"default","tag":"Dashboards","count":23},{"language":"default","tag":"Billing Data","count":23},{"language":"default","tag":"Use Cases","count":17},{"language":"default","tag":"Reports","count":16},{"language":"default","tag":"Metrics Correlation","count":13},{"language":"default","tag":"Events","count":11}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"use-cases/reallocate_api_costs","slug":"/use-cases/reallocate_api_costs","pageMetadata":{"title":"Split Shared API Costs Across Teams Using Usage Metrics","description":"Allocate untagged or shared API costs to teams based on usage data, from connecting an external metric to a reusable chargeback model in Costory.","sidebarTitle":"Reallocate shared API costs","mode":"wide","href":"/use-cases/reallocate_api_costs"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Allocate untagged or shared API costs to teams based on usage data, from connecting an external metric to a reusable chargeback model in Costory.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,Check,CodeBlock,Frame,Heading,Mermaid,OptimizedImage,Step,Steps,Tab,Table,Tabs,Tip,Tooltip}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!Check)_missingMdxReference(`Check`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Mermaid)_missingMdxReference(`Mermaid`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Tooltip)_missingMdxReference(`Tooltip`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`When part of your cloud bill is untagged, for example a shared API gateway used by several teams, tags alone can’t attribute it. Without `,_jsx(Tooltip,{tip:`The process of assigning shared or untagged cloud costs to specific teams, products, or environments.`,cta:`See Glossary`,href:`/docs/glossary#cost-allocation`,children:`cost allocation`}),`, those costs land in an “other” bucket, and chargeback or showback becomes impossible.`]}),`\n`,_jsxs(_components.p,{children:[`This guide splits shared API costs proportionally. You connect an external usage metric (API call counts per team) in Costory, then build a reusable `,_jsx(Tooltip,{tip:`Rule-based dimensions that map cloud resources to business groupings like teams, products, or environments.`,cta:`See Glossary`,href:`/docs/glossary#virtual-dimensions`,children:`virtual dimension`}),` that attributes the right share of cost to each team going forward.`]}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`You have identified the total cost of this API in your billing data.`}),`\n`,_jsx(_components.li,{children:`You have a usage metric from your internal monitoring tool (e.g., API call counts per team) that can serve as an allocation key to split costs across callers.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`In this example, you will use an AWS S3 Parquet file that looks like:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{style:{textAlign:`left`},children:`date`}),_jsx(_components.th,{style:{textAlign:`left`},children:`team`}),_jsx(_components.th,{style:{textAlign:`left`},children:`region`}),_jsx(_components.th,{style:{textAlign:`right`},children:`api_call_count`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`2025-12-01 00:00:00`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Team_A`}),_jsx(_components.td,{style:{textAlign:`left`},children:`North`}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`right`},children:`1081`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`2025-12-01 00:00:00`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Team_A`}),_jsx(_components.td,{style:{textAlign:`left`},children:`South`}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`right`},children:`1330`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`2025-12-01 00:00:00`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Team_A`}),_jsx(_components.td,{style:{textAlign:`left`},children:`East`}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`right`},children:`1201`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`2025-12-01 00:00:00`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Team_A`}),_jsx(_components.td,{style:{textAlign:`left`},children:`West`}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`right`},children:`505`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`left`},children:`2025-12-01 00:00:00`}),_jsx(_components.td,{style:{textAlign:`left`},children:`Team_B`}),_jsx(_components.td,{style:{textAlign:`left`},children:`North`}),_jsx(_components.td,{\"data-numeric\":`true`,style:{textAlign:`right`},children:`983`})]})]})]}),`\n`,_jsx(_components.p,{children:`For each team and region, you know how many API calls were made.`}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`This use case uses an AWS S3 Parquet file, but you can use any source on the `,_jsx(_components.a,{href:`/setup/usage-metrics`,children:`External metric`}),` grid: Datadog, Datadog CI Visibility, Amplitude, BigQuery, Google Sheets, Tsuga, CloudWatch, or S3.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`what-you-get-per-team-cost-attribution`,children:`What you get: per-team cost attribution`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`A per-team cost view based on actual API usage, ready for chargeback or showback.`}),`\n`,_jsxs(_components.li,{children:[`A reusable `,_jsx(Tooltip,{tip:`Rule-based dimensions that map cloud resources to business groupings like teams, products, or environments.`,cta:`See Glossary`,href:`/docs/glossary#virtual-dimensions`,children:`virtual dimension`}),` that automatically allocates the shared cost going forward, with no manual updates needed.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`how-it-works`,children:`How it works`}),`\n`,_jsx(_components.p,{children:`The overall flow is: export a usage metric from your monitoring system, import it into Costory, preview the proportional split, then lock it in with a Virtual Dimension.`}),`\n`,_jsx(Mermaid,{chart:`graph LR\n A[\"Usage metric (S3 Parquet)\"] --> B[\"Costory Metric\"]\n B --> C[\"Explorer preview\"]\n C --> D[\"Virtual Dimension\"]\n D --> E[\"Per-team cost view\"]`}),`\n`,_jsx(Heading,{level:`2`,id:`how-to-split-shared-api-costs-step-by-step`,children:`How to split shared API costs step by step`}),`\n`,_jsxs(Steps,{children:[_jsx(Step,{title:`Create a bucket and share access with Costory`,children:_jsx(Accordion,{title:`Terraform / Manual setup`,id:`terraform-manual-setup`,children:_jsxs(Tabs,{children:[_jsx(Tab,{title:`Terraform`,id:`terraform`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`107`,language:`hcl`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`hcl`,children:_jsxs(_components.code,{language:`hcl`,numberOfLines:`107`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`terraform`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` required_providers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` aws`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` source`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"hashicorp/aws\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` version`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \">= 5.0\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` costory`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` source`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"costory-io/costory\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` version`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \">= 0.1.0\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`variable`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"costory_token\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` string`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` description`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Costory API token.\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` sensitive`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`variable`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"s3_name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` string`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` description`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Base name for the S3 bucket.\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` default`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"costory-allocation-data\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`provider`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"aws\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`provider`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"costory\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` token`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` var`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`costory_token`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`data`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"aws_caller_identity\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"current\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`data`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"costory_service_account\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"current\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`locals`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` account_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`aws_caller_identity`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`current`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`account_id`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bucket_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`var`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`s3_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`-`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`local`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`account_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# --- S3 bucket ---`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`resource`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"aws_s3_bucket\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"allocation\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bucket`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` local`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bucket_name`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`resource`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"aws_s3_bucket_public_access_block\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"allocation\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bucket`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` aws_s3_bucket`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`allocation`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` block_public_acls`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` block_public_policy`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ignore_public_acls`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` restrict_public_buckets`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# --- IAM policy: allow read on the bucket ---`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`data`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"aws_iam_policy_document\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"read_s3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` statement`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` sid`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"AllowReadAllocation\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` effect`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Allow\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` actions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"s3:ListBucket\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"s3:GetObject\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` resources`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` aws_s3_bucket`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`allocation`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`arn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`aws_s3_bucket`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`allocation`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`arn`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/*\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`resource`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"aws_iam_policy\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"read_s3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"costory-read-s3-`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`var`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`s3_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` description`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Allows Costory to read the allocation S3 bucket.\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` policy`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`aws_iam_policy_document`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`read_s3`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`json`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`data`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"aws_iam_policy_document\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"federated_assume\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` statement`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` effect`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Allow\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` actions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sts:AssumeRoleWithWebIdentity\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` principals`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Federated\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` identifiers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"accounts.google.com\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` condition`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` test`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"StringEquals\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` variable`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"accounts.google.com:sub\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` values`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`costory_service_account`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`current`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`sub_ids`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`resource`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"aws_iam_role\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"federated\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"costory-trust-link-`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`var`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`s3_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` assume_role_policy`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`aws_iam_policy_document`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`federated_assume`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`json`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`resource`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"aws_iam_role_policy_attachment\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"read_s3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` role`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` aws_iam_role`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`federated`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`name`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` policy_arn`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` aws_iam_policy`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`read_s3`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`arn`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})}),_jsx(Tab,{title:`Manual`,id:`manual`,children:_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Create an S3 bucket`}),`\n`,_jsx(_components.li,{children:`Create an IAM role with READ and LIST permissions on this bucket`}),`\n`,_jsx(_components.li,{children:`Add a federated trust policy so the Costory service account can assume the role`}),`\n`,_jsx(_components.li,{children:`Attach the read policy to the role`}),`\n`]})})]})})}),_jsxs(Step,{title:`Schedule the metric export`,children:[_jsx(_components.p,{children:`Create a scheduled job (cron, Airflow, GitHub Actions, or any orchestrator) that writes the metric file to the bucket every day. The job should:`}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Output format`}),`: A Parquet file with one row per combination of dimensions per day. At minimum, include a `,_jsx(_components.code,{children:`date`}),` column, one or more dimension columns (e.g., `,_jsx(_components.code,{children:`team`}),`, `,_jsx(_components.code,{children:`region`}),`), and a numeric value column (e.g., `,_jsx(_components.code,{children:`api_call_count`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`S3 prefix`}),`: Write files under a consistent prefix, for example `,_jsx(_components.code,{children:`s3://\u003cbucket>/api_cost_allocations/`}),`. Costory scans this prefix for new files.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Overwrite strategy`}),`: You can safely write a new file each day. Costory applies an incremental overwrite strategy: for a given day, the last data received wins, and existing data for other days is preserved.`]}),`\n`]}),_jsx(Tip,{children:_jsx(_components.p,{children:`You can force a re-import on demand from the Metrics DataSource page. Otherwise, files are imported automatically every day at 06:00 UTC.`})})]}),_jsxs(Step,{title:`Create the metric in Costory`,children:[_jsxs(Tabs,{children:[_jsx(Tab,{title:`Terraform`,id:`terraform-2`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`19`,language:`hcl`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`hcl`,children:_jsxs(_components.code,{language:`hcl`,numberOfLines:`19`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Add this to the same Terraform configuration as the previous step.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`resource`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"costory_metrics_datasource_s3_parquet\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"single_dims\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"API Usage\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bucket_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` local`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bucket_name`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` prefix`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"api_cost_allocations\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` role_arn`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` aws_iam_role`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`federated`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`arn`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` metrics_definition`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` metric_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"API Usage\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` gap_filling`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"ZERO\"`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // How to handle missing values for a day`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` aggregation`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"SUM\"`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // How to aggregate the metric across multiple days`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` value_column`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"api_call_count\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` date_column`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"date\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` dimensions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"region\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"team\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` unit`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"calls\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})}),_jsx(Tab,{title:`Manual`,id:`manual-2`,children:_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Go to the Metrics DataSource Page and create a new metric.`}),`\n`,_jsx(_components.li,{children:`Select the S3 bucket and the file name.`}),`\n`,_jsx(_components.li,{children:`Select the column that contains the date.`}),`\n`,_jsx(_components.li,{children:`Select the column that contains the team.`}),`\n`,_jsx(_components.li,{children:`Select the column that contains the region.`}),`\n`,_jsx(_components.li,{children:`Select the column that contains the API call count.`}),`\n`,_jsx(_components.li,{children:`Save the metric.`}),`\n`]})})]}),_jsx(Check,{children:`The metric will take a few minutes to be ingested. Once ready, you can see it and its values in Costory.`}),_jsx(Frame,{caption:`The Metrics Datasources page showing the imported API Usage metric as Active`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/costory/eYn3vPzyhd5sQYvV/images/make_metric_visible.gif?s=9caec955ade2c9dacbe08a93678fd7da`,alt:`Metrics Datasources page with the API Usage metric listed and marked Active`,\"data-og-width\":`1068`,width:`1068`,\"data-og-height\":`476`,height:`476`,\"data-path\":`images/make_metric_visible.gif`,\"data-optimize\":`true`,\"data-opv\":`3`})})]}),_jsxs(Step,{title:`Preview the reallocation`,children:[_jsxs(_components.p,{children:[`Use `,_jsx(_components.a,{href:`/features/cost-explorer`,children:`Explorer`}),` to preview how the reallocated costs would look before committing to a virtual dimension.`]}),_jsx(_components.p,{children:`The idea is to build a formula that computes each team’s proportional share of the total API cost:`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Row`}),_jsx(_components.th,{children:`What it represents`}),_jsx(_components.th,{children:`Example`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`a`})}),_jsx(_components.td,{children:`API Usage metric, grouped by team`}),_jsx(_components.td,{children:`Team A: 4 117 calls, Team B: 983 calls`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`b`})}),_jsx(_components.td,{children:`Total API usage across all teams`}),_jsx(_components.td,{children:`5 100 calls`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`c`})}),_jsxs(_components.td,{children:[`The reallocation formula: `,_jsx(_components.code,{children:`a / b * d`})]}),_jsx(_components.td,{children:`Team A gets 80.7% of the cost`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`d`})}),_jsx(_components.td,{children:`Total cost of the shared API resource`}),_jsx(_components.td,{\"data-numeric\":`true`,children:`$1 000`})]})]})]}),_jsxs(_components.p,{children:[`The formula `,_jsx(_components.code,{children:`a / b * d`}),` gives you: `,_jsx(_components.strong,{children:`(team’s calls / total calls) * total cost = team’s share`}),`.`]}),_jsx(Frame,{caption:`Explorer showing the reallocation formula: team usage (a) / total usage (b) * total cost (d)`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/costory/eYn3vPzyhd5sQYvV/images/example_formula_reallocation.png?fit=max\u0026auto=format\u0026n=eYn3vPzyhd5sQYvV\u0026q=85\u0026s=1f0d4c4895450206b96fd67229a67b55`,alt:`Explorer with four rows building a proportional cost reallocation formula`,\"data-og-width\":`1697`,width:`1697`,\"data-og-height\":`362`,height:`362`,\"data-path\":`images/example_formula_reallocation.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/costory/eYn3vPzyhd5sQYvV/images/example_formula_reallocation.png?w=280\u0026fit=max\u0026auto=format\u0026n=eYn3vPzyhd5sQYvV\u0026q=85\u0026s=80a90e2f9348b9f50963b9969123d4b3 280w, https://mintcdn.com/costory/eYn3vPzyhd5sQYvV/images/example_formula_reallocation.png?w=560\u0026fit=max\u0026auto=format\u0026n=eYn3vPzyhd5sQYvV\u0026q=85\u0026s=38470d9a0b3ace9cff76a4b0c9825a1f 560w, https://mintcdn.com/costory/eYn3vPzyhd5sQYvV/images/example_formula_reallocation.png?w=840\u0026fit=max\u0026auto=format\u0026n=eYn3vPzyhd5sQYvV\u0026q=85\u0026s=3d8fcb59f2453472c56d2e99e8586dc1 840w, https://mintcdn.com/costory/eYn3vPzyhd5sQYvV/images/example_formula_reallocation.png?w=1100\u0026fit=max\u0026auto=format\u0026n=eYn3vPzyhd5sQYvV\u0026q=85\u0026s=651774ac05120d998e8f4e7541a17ab2 1100w, https://mintcdn.com/costory/eYn3vPzyhd5sQYvV/images/example_formula_reallocation.png?w=1650\u0026fit=max\u0026auto=format\u0026n=eYn3vPzyhd5sQYvV\u0026q=85\u0026s=c87b17a212b81676f07118d7df92f1f6 1650w, https://mintcdn.com/costory/eYn3vPzyhd5sQYvV/images/example_formula_reallocation.png?w=2500\u0026fit=max\u0026auto=format\u0026n=eYn3vPzyhd5sQYvV\u0026q=85\u0026s=03817f3b29c391bb5fd09603d824e587 2500w`})})]}),_jsxs(Step,{title:`Create the Virtual Dimension`,children:[_jsxs(_components.p,{children:[`Create a `,_jsx(_components.a,{href:`/features/tagging/dimensions#virtual-dimensions`,children:`virtual dimension`}),` that automatically allocates the shared cost going forward.`]}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Add a new rule for those API costs:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Rely on reallocation based on usage metrics`}),`\n`,_jsx(_components.li,{children:`Use the metric you just imported`}),`\n`,_jsxs(_components.li,{children:[`Choose an allocation strategy:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Identity mapping: The new label value is the team name`}),`\n`,_jsx(_components.li,{children:`Regex mapping: The API name contains the team name (extract it with a regex)`}),`\n`,_jsx(_components.li,{children:`Manual mapping: The API name has no relation to the team name; map each name manually`}),`\n`]}),`\n`]}),`\n`]}),`\n`]}),`\n`,_jsx(_components.li,{children:`Save the virtual dimension`}),`\n`]}),_jsx(_components.p,{children:`Watch how a Virtual Dimension rule is configured with dynamic allocation based on the imported usage metric:`}),_jsx(Frame,{caption:`Creating a Virtual Dimension rule that dynamically allocates API costs based on the imported usage metric`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/costory/eYn3vPzyhd5sQYvV/images/save_vdim_allocation.gif?s=d3741af89ee4c25cde56664c6bdd1876`,alt:`Walkthrough of creating a Virtual Dimension with dynamic allocation based on usage metrics`,\"data-og-width\":`824`,width:`824`,\"data-og-height\":`480`,height:`480`,\"data-path\":`images/save_vdim_allocation.gif`,\"data-optimize\":`true`,\"data-opv\":`3`})})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps-automate-and-share`,children:`Next steps: automate and share`}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Prefer to skip the UI? The `,_jsx(_components.a,{href:`/features/mcp`,children:`Costory MCP`}),` can draft, preview, and publish this reallocation virtual dimension from chat. Try “draft a virtual dimension that splits my API gateway cost across teams using the API Usage metric, then show me the preview.”`]})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Set up a `,_jsx(_components.a,{href:`/features/slack-reports`,children:`weekly Slack report`}),` to share the reallocated costs with each team automatically.`]}),`\n`,_jsxs(_components.li,{children:[`Explore the results in `,_jsx(_components.a,{href:`/features/cost-explorer`,children:`Explorer`}),` to validate cost attribution per team.`]}),`\n`,_jsxs(_components.li,{children:[`Build on this allocation to create a `,_jsx(_components.a,{href:`/use-cases/automate_budget`,children:`budget tracking`}),` workflow per team.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Split Shared API Costs Across Teams Using Usage Metrics","description":"Allocate untagged or shared API costs to teams based on usage data, from connecting an external metric to a reusable chargeback model in Costory.","sidebarTitle":"Reallocate shared API costs","mode":"wide","href":"/use-cases/reallocate_api_costs"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Prerequisites","slug":"prerequisites","depth":2,"children":[]},{"title":"What you get: per-team cost attribution","slug":"what-you-get-per-team-cost-attribution","depth":2,"children":[]},{"title":"How it works","slug":"how-it-works","depth":2,"children":[]},{"title":"How to split shared API costs step by step","slug":"how-to-split-shared-api-costs-step-by-step","depth":2,"children":[]},{"title":"Next steps: automate and share","slug":"next-steps-automate-and-share","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"costory","siteName":"Costory Documentation","title":"Split Shared API Costs Across Teams Using Usage Metrics - Costory Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-12T10:13:03.663Z","gitLastModified":"2026-11-12T10:12:25.000Z","originalFileLocation":"use-cases/reallocate_api_costs.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"light\";if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Allocate untagged or shared API costs to teams based on usage data, from connecting an external metric to a reusable chargeback model in Costory.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Costory Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/svg+xml\" sizes=\"180x180\" href=\"https://mintcdn.com/costory/stODLWETeKeyz7ed/favicon-new.svg?fit=max\u0026amp;auto=format\u0026amp;n=stODLWETeKeyz7ed\u0026amp;q=85\u0026amp;s=334ff5307103e4ffc0473bb6e1b9b56c\">\u003clink data-mint-head rel=\"icon\" type=\"image/svg+xml\" sizes=\"32x32\" href=\"https://mintcdn.com/costory/stODLWETeKeyz7ed/favicon-new.svg?fit=max\u0026amp;auto=format\u0026amp;n=stODLWETeKeyz7ed\u0026amp;q=85\u0026amp;s=334ff5307103e4ffc0473bb6e1b9b56c\">\u003clink data-mint-head rel=\"icon\" type=\"image/svg+xml\" sizes=\"16x16\" href=\"https://mintcdn.com/costory/stODLWETeKeyz7ed/favicon-new.svg?fit=max\u0026amp;auto=format\u0026amp;n=stODLWETeKeyz7ed\u0026amp;q=85\u0026amp;s=334ff5307103e4ffc0473bb6e1b9b56c\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/svg+xml\" href=\"https://mintcdn.com/costory/stODLWETeKeyz7ed/favicon-new.svg?fit=max\u0026amp;auto=format\u0026amp;n=stODLWETeKeyz7ed\u0026amp;q=85\u0026amp;s=334ff5307103e4ffc0473bb6e1b9b56c\">\u003cmeta data-mint-head property=\"og:title\" content=\"Split Shared API Costs Across Teams Using Usage Metrics - Costory Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Allocate untagged or shared API costs to teams based on usage data, from connecting an external metric to a reusable chargeback model in Costory.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Costory Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.costory.io/use-cases/reallocate_api_costs\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://costory.mintlify.site/_mintlify/api/og/v2?division=Annotate\u0026amp;title=Split+Shared+API+Costs+Across+Teams+Using+Usage+Metrics\u0026amp;description=Allocate+untagged+or+shared+API+costs+to+teams+based+on+usage+data%2C+from+connecting+an+external+metric+to+a+reusable+chargeback+model+in+Costory.\u0026amp;theme=1281d3dcbd6f73a9ab3b217e\u0026amp;signature=b6850502808befa692eb526de25ecbeb83ead166f328f6298bf7af6960c4236b\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Split Shared API Costs Across Teams Using Usage Metrics - Costory Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Allocate untagged or shared API costs to teams based on usage data, from connecting an external metric to a reusable chargeback model in Costory.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://costory.mintlify.site/_mintlify/api/og/v2?division=Annotate\u0026amp;title=Split+Shared+API+Costs+Across+Teams+Using+Usage+Metrics\u0026amp;description=Allocate+untagged+or+shared+API+costs+to+teams+based+on+usage+data%2C+from+connecting+an+external+metric+to+a+reusable+chargeback+model+in+Costory.\u0026amp;theme=1281d3dcbd6f73a9ab3b217e\u0026amp;signature=b6850502808befa692eb526de25ecbeb83ead166f328f6298bf7af6960c4236b\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"https://mintlify.s3.us-west-1.amazonaws.com/costory/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Costory Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#1D3C93\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.costory.io/use-cases/reallocate_api_costs\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/use-cases/reallocate_api_costs.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.costory.io/#organization\",\"name\":\"Costory Documentation\",\"url\":\"https://docs.costory.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/costory/jdghijjvsrOsYiTC/logo/light.png?fit=max\u0026auto=format\u0026n=jdghijjvsrOsYiTC\u0026q=85\u0026s=dee63acdba91bf952855557cc5c5ec16\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.costory.io#website\",\"name\":\"Costory Documentation\",\"url\":\"https://docs.costory.io\",\"publisher\":{\"@id\":\"https://docs.costory.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.costory.io/use-cases/reallocate_api_costs#webpage\",\"url\":\"https://docs.costory.io/use-cases/reallocate_api_costs\",\"name\":\"Split Shared API Costs Across Teams Using Usage Metrics\",\"description\":\"Allocate untagged or shared API costs to teams based on usage data, from connecting an external metric to a reusable chargeback model in Costory.\",\"dateModified\":\"2026-11-12T10:12:25.000Z\",\"isPartOf\":{\"@id\":\"https://docs.costory.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.costory.io/use-cases/reallocate_api_costs#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.costory.io/use-cases/reallocate_api_costs#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Costory Documentation\",\"item\":\"https://docs.costory.io\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Split Shared API Costs Across Teams Using Usage Metrics\",\"item\":\"https://docs.costory.io/use-cases/reallocate_api_costs\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.costory.io/use-cases/reallocate_api_costs#article\",\"headline\":\"Split Shared API Costs Across Teams Using Usage Metrics\",\"name\":\"Split Shared API Costs Across Teams Using Usage Metrics\",\"description\":\"Allocate untagged or shared API costs to teams based on usage data, from connecting an external metric to a reusable chargeback model in Costory.\",\"url\":\"https://docs.costory.io/use-cases/reallocate_api_costs\",\"mainEntityOfPage\":{\"@id\":\"https://docs.costory.io/use-cases/reallocate_api_costs#webpage\"},\"dateModified\":\"2026-11-12T10:12:25.000Z\",\"publisher\":{\"@id\":\"https://docs.costory.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.costory.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Costory Documentation\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Costory Documentation\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/use-cases/reallocate_api_costs.md","siteName":"Costory Documentation","nav":{"global":null,"tabs":[{"tab":"Documentation","icon":"book","pages":[{"title":"Documentation","href":"/get-started/welcome"}]},{"tab":"Use Cases","icon":"lightbulb","pages":[{"title":"Overview","href":"/use-cases/overview"},{"group":"Explore","pages":[{"title":"LLM Cost Allocation: Track AI Spend by Team, Feature, and Customer","sidebarTitle":"Allocate LLM cost per team","mode":"wide","href":"/use-cases/llm-ai-cost"},{"title":"Hourly Granularity for Bursty Workloads","href":"/use-cases/hourly-cost-granularity"},{"title":"AWS EKS Cost Allocation","href":"/use-cases/eks-cost-allocation"},{"title":"Kubernetes Cost Visibility: Measure Waste, Allocate Costs, Reduce Over-Provisioning","sidebarTitle":"Kubernetes cost \u0026 waste","href":"/use-cases/k8s_waste/visibility"},{"title":"Increase visibility on your BigQuery costs with dbt","description":"Track and allocate BigQuery processing and storage costs at the dbt model level using labels, then visualize them in Costory.","sidebarTitle":"BigQuery cost visibility","href":"/use-cases/dbt_bigquery_visibility/increase_visibility"}]},{"group":"Annotate","pages":[{"title":"Split Shared API Costs Across Teams Using Usage Metrics","sidebarTitle":"Reallocate shared API costs","mode":"wide","href":"/use-cases/reallocate_api_costs"},{"title":"Allocate the cost of a shared Cloud SQL database to the teams using it","description":"Use Costory's virtual dimensions and usage metrics to split a shared Cloud SQL database cost across consuming teams, based on actual storage or compute usage.","sidebarTitle":"Cloud SQL cost allocation","href":"/use-cases/allocate_shared_cloud_sql_database/allocate"},{"title":"Automated env allocation","sidebarTitle":"Automated env allocation","href":"/use-cases/automated_env_allocation/visibility"},{"title":"Event Correlations","sidebarTitle":"Correlate with events","href":"/automate-reporting/event-correlation"}]},{"group":"Analyze","pages":[{"title":"Correlate Cloud Costs with Active Users Using Amplitude","sidebarTitle":"Correlate with active users (Amplitude)","href":"/use-cases/amplitude/cost_per_active_users"},{"title":"Track Unit Economics to Justify Cloud Cost Increases","sidebarTitle":"Justify cost increases","href":"/automate-reporting/unit-economics"}]},{"group":"Share","pages":[{"title":"Cloud budget management: define and automate cloud budgets","sidebarTitle":"Automate your cloud budget","mode":"wide","href":"/use-cases/automate_budget"},{"title":"Share the correct cost for each persona","sidebarTitle":"Cost metrics per persona","href":"/use-cases/show_the_correct_cost_metric_to_each_persona"},{"title":"Show the correct metrics to your exec team","sidebarTitle":"Finops metrics for exec team","href":"/use-cases/what_your_exec_team_wants/value"},{"title":"Automate Monthly Cloud Cost Reporting","sidebarTitle":"Monthly cost reporting","href":"/automate-reporting/monthly-reviews"},{"title":"Give every team its own cost report","sidebarTitle":"Team cost reports","href":"/automate-reporting/team-cost-reports"}]}]},{"tab":"API Reference","icon":"code","pages":[{"title":"API Reference","href":"/api-reference/overview"}]},{"tab":"Changelog","icon":"clock-rotate-left","pages":[{"title":"Changelog","href":"/changelog"}]}]},"basePath":"","title":"Split Shared API Costs Across Teams Using Usage Metrics - Costory Documentation","buildId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","deploymentId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","dynamics":["07c022d89b","a74be98ba7","a9bb46feb3"],"chunks":["Frame-u3J1-UOn.js","DynamicMarkdown-B-f2cqXQ.js","zoom-image-lightbox-DTFzvaXJ.js","lightbox-handle-r17bVUz3.js","Markdown-D13FWkIM.js","clsx-D3Isdib3.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-C-XZBk9h.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink--qIqmmVG.js"]}