Skip to content

Infrastructure cost reports

ID MOD-099
System SD07
Repo bank-platform
Build status Deployed
Deployed Yes
Last commit bbdfbac46a1b5cf6dc25b4c7cd428a8daa669d03

Billing schema ownership

MOD-099 owns the billing.* Snowflake schema. This is an explicit ownership transfer — MOD-098 provisioned BILLING.TENANT_MODULES and BILLING.TENANT_TIERS as stubs to unblock its own dbt models, pending MOD-099 shipping.

When MOD-099 is built, the agent must:

  1. Provision BILLING.TENANT_MODULES and BILLING.TENANT_TIERS in MOD-099-usage-billing-report/infra/snowflake/ with the canonical schema (see MOD-098 design doc for the current stub definitions — MOD-099 should adopt these column shapes and extend them as needed).
  2. Add BILLING.INVOICES and BILLING.INVOICE_LINE_ITEMS tables to the same infra/snowflake/ directory.
  3. Remove billing.sql and billing_*.sql from MOD-098-cost-attribution-engine/infra/snowflake/ in a co-ordinated deployment — MOD-099 must be deployed first so the tables exist before MOD-098's DDL files are removed. Use CREATE TABLE IF NOT EXISTS in MOD-099's scripts so a re-run against an already-populated schema is safe.
  4. Update dbt/models/MOD-098-cost-attribution-engine/sources.yml to reference the billing.* tables as an external source owned by MOD-099 rather than as a source owned by MOD-098 itself.

Deployment order constraint: MOD-099 DDL must be applied before MOD-098's stub DDL is removed. The CI/CD workflow for the MOD-098 cleanup commit must depend on a successful MOD-099 deploy.


Purpose

MOD-099 surfaces the cost attribution data computed by MOD-098 as a transparent, usable report for two audiences: the licensee (who needs to understand what they are paying for and why) and internal finance (who need to understand unit economics, gross margin, and platform cost trends).

The transparency principle is a deliberate commercial decision. Licensees who can see their usage breakdown in real time are less likely to dispute invoices, more likely to trust the platform, and better positioned to forecast their own costs.

Licensee-facing dashboard

Available in the back-office portal under Billing & Usage. Accessible to any user with the BILLING_VIEWER or BILLING_ADMIN access grant on their tenant context.

Current period summary card

Billing period: 1 Apr – 30 Apr 2026
Customer levy:       $4,200.00   (1,400 active customers × $3.00)
Facility fees:       $2,750.00   (11 modules × $250.00/month)
Variable usage:      $  830.40   (see breakdown)
Infrastructure:      $  412.00   (passthrough — see detail)
─────────────────────────────────
Estimated total:     $8,192.40
(Final invoice issued 3 May 2026)

Variable usage drill-down

Resource type Included Used Overage Rate Charge
Snowflake credits 500 823 323 $0.50/credit $161.50
ML inferences 50,000 94,200 44,200 $0.003/call $132.60
Enrichment API calls 100,000 187,400 87,400 $0.002/call $174.80
Notification sends 20,000 51,300 31,300 $0.008/send $250.40
Document storage 10 GB 13.9 GB 3.9 GB $28.80/GB/mo $111.10

Module-level breakdown

Module Facility fee ML inferences Enrichment calls Snowflake credits Total
MOD-009 eIDV $250 12,400 calls 18 credits $274.80
MOD-039 Risk scoring $250 94,200 inferences 380 credits $564.90
MOD-041 Categorisation $250 175,000 calls 425 credits $963.50

Infrastructure passthrough (optional toggle)

AWS service Cost
Lambda $84.20
API Gateway $63.40
Kinesis Firehose $41.10
S3 $28.90
DynamoDB $19.80
EventBridge + SQS $12.30
Secrets Manager $8.20
Snowflake (dedicated warehouse) $154.10
Total passthrough $412.00

Trend chart

30-day rolling chart showing daily estimated cost, with annotations for significant events ("New module activated", "Customer count crossed 1,000").

Export

  • Download current period breakdown as CSV or PDF
  • API endpoint: GET /billing/usage?period=2026-04&format=json (authenticated, tenant-scoped)

Internal finance view

Accessible to Finance and Platform teams in the back-office portal.

Gross margin by tenant

Tenant Revenue AWS cost Snowflake cost External APIs Total cost Gross margin
Tenant A $8,192 $264 $154 $112 $530 93.5%
Tenant B $3,450 $118 $67 $44 $229 93.4%

Unit economics

Module Cost per customer per month At 1,000 customers At 10,000 customers
MOD-009 eIDV $0.12 $120 $890 (scale discount)
MOD-039 Risk score $0.38 $380 $2,800
MOD-041 Categorisation $0.69 $690 $4,100

Unattributed cost monitor

Any AWS costs with no tenant_id tag appear here. A non-zero unattributed bucket is a tagging governance gap and triggers an engineering alert.


Invoice generation

At the end of each billing period, MOD-099 generates: - One billing.invoices record per tenant with the period total - One billing.invoice_line_items record per billing component (customer levy, each facility fee, each variable line, passthrough) - Invoice status flows: DRAFTISSUEDPAID / DISPUTED - PDF invoice generated and stored in S3 (ADR-028); URL written to the invoice record - bank-platform.invoice_issued EventBridge event triggers notification to the licensee's billing contact


Module dependencies

Depends on

Module Title Required? Contract Reason
MOD-098 Cost attribution engine Required Reporting views and Dynamic Tables read from MOD-098's metering schema (aws_cost_daily, snowflake_credit_daily, daily_tenant_summary, billing_period_summary, unit_economics) in BANK_{ENV}_RISK.
MOD-102 Snowflake account configuration & governance Required Snowflake account and BANK_{ENV}PLATFORM database provisioned by MOD-102 must exist before this module can create the REPORTS schema and objects; cross-database SELECT grant on BANK_RISK.METERING also applied by MOD-102 setup.

Required by

(No modules in this wiki currently declare a dependency on this module.)


Policies satisfied

Policy Title Mode How
REP-001 Regulatory Reporting Policy LOG Infrastructure cost history is retained as queryable Snowflake records — provides audit trail for AWS and Snowflake spend by service, period, and attributed tenant.

Capabilities satisfied

Capability Title Mode How
CAP-140 CAP-140 CALC Provides Snowflake views and Dynamic Tables in BANK_{ENV}PLATFORM.REPORTS aggregating MOD-098's metering data; surfaces daily AWS and Snowflake costs by service, environment, and tenant — directly queryable from Snowsight and Streamlit without access to the BANK_RISK database.

Part of SD07 — Data Platform & Governance Infrastructure Compiled 2026-05-22 from source/entities/modules/MOD-099.yaml