# Core Cost Fields for Cloud Billing Schemas

This document summarizes the core fields used for cost analysis based on schema snapshots under `docs/schema-data-json/`. For full field lists, see the corresponding JSON files.

## AWS CUR 1.0 (`aws_nonprod_billing` / `aws_prod_billing`)

| Category | Field | Description |
| --- | --- | --- |
| Billing period | `bill_billing_period_start_date`, `bill_billing_period_end_date`, `bill_invoice_id` | billing period and invoice |
| Account | `bill_payer_account_id`, `line_item_usage_account_id` | payer and usage accounts |
| Time | `line_item_usage_start_date`, `line_item_usage_end_date` | usage time |
| Cost | `line_item_unblended_cost`, `line_item_blended_cost` | unblended and blended cost |
| Usage | `line_item_usage_amount`, `line_item_usage_unit` | usage and unit |
| Product | `product_servicecode`, `product_product_family`, `line_item_product_code` | service and product family |
| Pricing | `pricing_term`, `pricing_unit`, `pricing_public_on_demand_cost` | price terms and on-demand price |
| Resource | `line_item_resource_id` | resource identifier (ARN, etc.) |
| Tags | `resource_tags_user_*` | tags flattened into columns |
| Partition | `year`, `month` | Hive partition columns (required filters) |

Schema examples:
- `docs/schema-data-json/schema_gcp-digital-bi_aws_prod_billing_aws_prod_billing_data.json`
- `docs/schema-data-json/schema_gcp-digital-bi_aws_nonprod_billing_013690006788_aws_billing_data.json`

## AWS CUR 2.0 (`aws_billing_no_payer`)

| Category | Field | Description |
| --- | --- | --- |
| Billing period | `bill_billing_period_start_date`, `bill_billing_period_end_date`, `bill_invoice_id` | billing period and invoice |
| Account | `bill_payer_account_id`, `line_item_usage_account_id`, `line_item_usage_account_name` | payer and usage accounts |
| Time | `line_item_usage_start_date`, `line_item_usage_end_date` | usage time (also the partition column) |
| Cost | `line_item_unblended_cost`, `line_item_blended_cost`, `line_item_net_unblended_cost` | unblended/blended/net cost |
| Usage | `line_item_usage_amount`, `line_item_usage_unit` | usage and unit |
| Product | `product_servicecode`, `product_product_family`, `line_item_product_code` | service and product family |
| Discount | `discount.key_value` | discount details (requires `UNNEST`) |
| Tags | `resource_tags.key_value` | tag key/value (requires `UNNEST`) |

Schema examples:
- `docs/schema-data-json/schema_gcp-digital-bi_aws_billing_no_payer_aws_billing_20251201.json`

## Alibaba Cloud (`alibaba_cloud`)

| Category | Field | Description |
| --- | --- | --- |
| Billing period | `billing_period` | billing period |
| Account | `account_id`, `owner_account_id` | sub-account and master account |
| Time | `partition_date`, `consumption_time` | partition date and usage time |
| Cost | `list_price`, `discount_amount`, `coupon_deduction`, `amount_after_discount` | list/discount/coupon/net |
| Product | `product_code`, `product_detail_code` | product and sub-product |
| Resource | `instance_id`, `instance_nickname` | resource instance |
| Organization | `financial_unit`, `resource_group` | financial unit and resource group |
| Tags | `instance_tags` | tags (JSON string) |

Schema examples:
- `docs/schema-data-json/schema_gcp-digital-bi_alibaba_cloud_daily_20250301.json`
- `docs/schema-data-json/schema_gcp-digital-bi_alibaba_cloud_monthly_20250801.json`

## Azure (`azure_billing`)

| Category | Field | Description |
| --- | --- | --- |
| Billing period | `invoiceId`, `billingPeriodStartDate`, `billingPeriodEndDate` | invoice and billing period |
| Account | `billingAccountId`, `billingProfileId`, `invoiceSectionId` | billing entity |
| Time | `date`, `servicePeriodStartDate`, `servicePeriodEndDate` | daily grain and service period |
| Cost | `costInUsd`, `costInBillingCurrency`, `unitPrice` | cost and unit price |
| Usage | `quantity`, `unitOfMeasure` | usage and unit |
| Product | `productName`, `meterCategory`, `meterSubCategory`, `meterRegion` | product and metering dimensions |
| Tags | `tags`, `tenant`, `usedby` | tags and internal markers |

Schema examples:
- `docs/schema-data-json/schema_gcp-digital-bi_azure_billing_azure_billing_cost_20250701.json`

## GCP Billing Export (`gcp_billing_v2`)

| Category | Field | Description |
| --- | --- | --- |
| Billing account | `billing_account_id` | billing account |
| Time | `usage_start_time`, `usage_end_time` | usage time |
| Cost | `cost`, `currency`, `credits.amount` | cost and credits (`credits.amount` is typically negative) |
| Usage | `usage.amount`, `usage.unit`, `usage.pricing_unit` | usage and pricing unit |
| Product | `service.description`, `sku.description` | service and SKU |
| Project | `project.id`, `project.name`, `project.labels` | project dimension |
| Location | `location.location`, `location.region`, `location.zone` | location dimension |
| Tags | `labels`, `tags`, `system_labels` | tags (requires `UNNEST`) |

Schema examples:
- `docs/schema-data-json/schema_gcp-digital-bi_gcp_billing_v2_gcp_billing_export_v1_01A169_D3D9BF_FB82A2.json`
