匯出價格資料的結構

本文件提供 Cloud Billing 定價資料架構的參考資訊,這些資料會匯出至 BigQuery 的各個資料表。

定價資料的結構定義

在 BigQuery 資料集中,Cloud Billing 帳戶定價資料會載入名為 cloud_pricing_export 的資料表。

以下資訊說明匯出至 BigQuery 的 Cloud Billing 帳戶定價資料架構。

欄位 類型 說明
export_time 時間戳記 與附加 Cloud Billing 資料相關聯的處理時間。每次執行新的匯出作業後,這個值一定會增加。
pricing_as_of_time 時間戳記 系統每天會產生一次 Cloud Billing 帳戶適用的定價資料,以便匯出至 BigQuery。這是產生定價資料的每日時間戳記。
billing_account_id 字串 與定價相關聯的 Cloud Billing 帳戶 ID。
business_entity_name 字串 提供 SKU 的 Google 服務系列名稱。值包括 GCP (Google Cloud) 或 Maps (Google Maps Platform)。
service.id 字串 回報 Cloud Billing 資料的 Google Cloud 服務或 Google Maps Platform API ID。例如 6F81-5844-456A。
service.description 字串 回報 Cloud Billing 資料的 Google Cloud 服務或 Google Maps Platform API 說明。例如「Compute Engine」。
sku.id 字串 服務所用資源 SKU 的專屬 ID。例如 2E27-4F75-95CD。如需完整的 SKU 清單,請參閱「Google Cloud SKU」。
sku.description 字串 服務所用資源 SKU 的人類可讀說明。例如「N1 Predefined Instance Core running in Americas」(在美洲執行的 N1 預先定義執行個體核心)。
sku.destination_migration_mappings 字串陣列 這個 SKU 要遷移的目的地 SKU 名稱。
product_taxonomy 字串陣列 套用至 SKU 的產品類別清單,例如「Serverless, Cloud Run, TaskQueue, VMs On Demand, Cores: Per Core」等。
geo_taxonomy 結構 適用於 SKU 的地理中繼資料,例如區域和多區域,像是 us-east4 和歐盟。
geo_taxonomy.type 字串 與 SKU 相關聯的地理中繼資料類型。有效值如下:
  • GLOBAL:沒有任何區域
  • REGIONAL:有一個區域
  • MULTI_REGION:有兩個以上的區域
geo_taxonomy.regions 字串陣列 與 SKU 相關聯的 Google Cloud 區域。例如 Europe-west2 或 US。

「區域」是特定的地理位置,例如倫敦。多區域是指包含兩個及以上地理位置的大型地理區域,例如美國。

pricing_unit 字串 用來指定定價的使用量單位簡寫 (例如 GiBy.mo)。
pricing_unit_description 字串 人類可讀的用量單位說明 (例如 Gibibyte 月)。
account_currency_code 字串 Cloud Billing 帳戶設定的運作幣別,使用 ISO 4217 定義的三字母貨幣代碼。詳情請參閱「 帳單和自動付款的當地幣別」。
currency_conversion_rate 字串 美元與 Cloud Billing 帳戶設定使用的 當地幣別之間的匯率。如果 Cloud Billing 帳戶的幣別是美元,匯率預設為 1.0。

如果 Cloud Billing 費用是以非美元貨幣計費,您可以使用以下公式將使用費換算為美元:cost ÷ currency_conversion_rate = 以美元計價的使用費。

Google 以當地幣別收費時,會根據主要金融機構公布的匯率,將價格換算成適用的當地幣別。包括以非美元貨幣結算時收取的任何附加費用。我們會採用 pricing_as_of_time當天適用的匯率。

sku_attributes 結構 包含描述 SKU 的鍵/值組合屬性,例如 model_name, gemini_2_5_flash 或 serving_method, batch。
sku_attributes.key 字串 SKU 屬性的鍵。例如:model_name、serving_method、modality 或 token_type。
sku_attributes.value 字串 SKU 屬性的值。例如:gemini_2_5_flash、batch、text 或 input。
sku_granular_usage_units 字串 SKU 的精細用量單位,例如 tokens。
list_price 結構

Google Cloud 或 Google Maps Platform SKU 的定價和 SKU 定價級別 (自 pricing_as_of_time起生效),以及預設計費模式價格。

list_price 包含描述定價結構和值的欄位,包括:

如要查看定價,請前往 list_price.tiered_rates.usd_amount

。

系統會為所有客戶產生並匯出定價資料。如果 Cloud Billing 帳戶有自訂合約價格,系統也會匯出 帳單帳戶專屬的定價資料。

billing_account_price 結構

如果您有合約價格,則這是與 Cloud Billing 帳戶連結的合約中自訂 SKU 價格,並採用預設計費模式價格。

billing_account_price 包含的欄位,說明 Google Cloud和 Google Maps Platform SKU 的自訂合約定價結構和價值,以及 SKU 定價級別。billing_account_price 包含:

如要查看合約價格 (如果適用於您的 Cloud Billing 帳戶),請前往 billing_account_price.tiered_rates.usd_amount

consumption_model_prices struct 清單 每個計費模式的 SKU 定價和帳單帳戶價格。
consumption_model_prices.consumption_model_id 字串 計費模式 ID。
consumption_model_prices.consumption_model_display_name 字串 計費模式的顯示名稱。
consumption_model_prices.list_price 結構

Google Cloud 或 Google Maps Platform SKU 的定價和 SKU 定價級別,自 pricing_as_of_time起生效,並採用指定的計費模式價格。

這個欄位會新增至 consumption_model_prices 結構,提供新計費模式下的定價檢視畫面,其中可能有多個值,例如預設、1 年和 3 年 CUD 值。如果是預設計費模式,這個值與 list_price 欄位相同,該欄位仍可供回溯相容。

如要進一步瞭解這個欄位的結構,請參閱 list_price。

consumption_model_prices.billing_account_price 結構

如果您有合約價格,則這是與 Cloud Billing 帳戶連結的合約中自訂 SKU 價格,並採用指定的計費模式價格。

這個欄位會新增至 consumption_model_prices 結構,提供新計費模式下的定價檢視畫面,其中可能有多個值,例如預設、1 年和 3 年 CUD 值。如果是預設計費模式,這個值與 billing_account_price 欄位相同,該欄位仍可供回溯相容。

詳情請參閱 billing_account_price。
price_info 結構 合約價格的背景資訊。
price_info.price_reason 字串

合約價格來源的背景資訊。

可能原因如下:

  • DEFAULT_PRICE:預設價格是 SKU 目前的定價。
  • FIXED_PRICE:合約協議條款期間,適用於 SKU 的固定價格。
  • FIXED_DISCOUNT:定價折扣百分比,以固定日期的定價為準。
  • FLOATING_DISCOUNT:目前定價的折扣百分比 (不以特定日期的定價為準)。
  • MIGRATED_PRICE:適用於從其他 SKU 遷移的價格。
  • MERGED_PRICE:合併多個來源後的 SKU 價格。舉例來說,如果合併級別,每個級別可以來自不同來源,並採用不同的折扣類型。
  • LIST_PRICE_AS_CEILING:這是選用的合約功能,適用於 2022 年 3 月 21 日後簽訂的新合約。啟用後,如果目前定價低於自訂固定價格,系統會將定價 (DEFAULT_PRICE) 用於 SKU 價格。適用於合約中所有固定價格 SKU,包括 FIXED_PRICE、FIXED_DISCOUNT、MIGRATED_PRICE 和 MERGED_PRICE。
  • CONTRACTED_PRICE_PROTECTION:這適用於合約中受價格保障的 SKU。這種情況很少見。
price_info.discount_percent 數字 如果合約價格是計入折扣百分比 (FIXED_DISCOUNT 或 FLOATING_DISCOUNT) 的計算結果,系統就會採用該折扣百分比。
price_info.discount_percent_fixed_date 日期 如果合約價格設為在特定日期 (FIXED_DISCOUNT) 套用折扣百分比,系統就會採用該日期。
price_info.discount_migrated_from 字串 如果是從其他 SKU (MIGRATED_PRICE) 遷移的合約定價折扣,這是折扣的來源 SKU。有時 SKU 拆分為兩個時,折扣會從舊 SKU 遷移至新 SKU。
aggregation_info 結構 代表單一 SKU 定價層級的匯總層級和間隔。
aggregation_info.aggregation_level 字串 用量匯總層級,用於計算 定價級別的費用。

等級包括:

  • ACCOUNT:表示 SKU 採用多級定價;定價級別的 SKU 用量是單一 Cloud Billing 帳戶中「所有」專案的總和。
  • PROJECT:表示 SKU 採用多級定價;各定價級別的 SKU 用量會依專案匯總。
  • UNKNOWN_AGGREGATION_LEVEL:表示 SKU 採用單一定價模式;這是非分級定價 SKU 的預設值。
aggregation_info.aggregation_interval 字串 用量匯總間隔,用於計算 定價級別的費用。

間隔包括:

  • ONE_DAY:表示 SKU 採用多級定價;系統每天會匯總各定價級別的 SKU 用量。
  • ONE_MONTH:表示 SKU 採用多級定價,系統每個月會匯總各定價級別的 SKU 用量。
  • UNKNOWN_AGGREGATION_INTERVAL:表示 SKU 採用單一級別定價;這是非分級定價 SKU 的預設值。
tiered_rates 字串陣列 定價級別的相關資訊,包括 SKU 的美元價格,以及 Cloud Billing 帳戶設定使用的 貨幣價格。

部分 SKU 只有一個價格級別。如果 SKU 有多個定價級別,每個定價級別會顯示在不同的資料列中。您可以使用 tiered_rates.start_usage_amount 找出有多個定價級別的 SKU。

tiered_rates.pricing_unit_quantity 浮點值 SKU 的價格級別單位數量。舉例來說,如果級別價格為每 1000000 個位元組 $1 美元,則這個資料欄會顯示 1000000。
tiered_rates.start_usage_amount 浮點值 特定 價格級別的計費單位數量下限。舉例來說,如果 SKU 有三個定價級別,例如 0-100 個單位、101-1000 個單位和 1001 個以上單位,則會顯示三個定價列,並以 0、101 和 1001 做為 [tiered_rates].start_usage_amount 值。
tiered_rates.usd_amount 數字 SKU 的價格 (以美元計價)。
tiered_rates.account_currency_amount 數字 SKU 的級別價格,從美元轉換為 Cloud Billing 帳戶設定使用的 貨幣,使用 currency_conversion_rate。

換算價格的計算公式如下:tiered_rates.usd_amount * currency_conversion_rate = tiered_rates.account_currency_amount。

Google 以當地幣別收費時,會根據主要金融機構公布的匯率,將價格換算成適用的當地幣別。包括以非美元貨幣結算時收取的任何附加費用。我們會採用 pricing_as_of_time當天適用的匯率。

關於價格級別

SKU 價格依定價級別而定。定價級別會根據不同級別提供定價結構。部分 SKU 只有一個價格級別,其他 SKU 則有多個價格級別。以下是多層級定價 SKU 的範例:

  • 提供免費使用層級的 SKU。例如:1 至 1,000 個單位免費。1001 個以上單位,每個 $1 美元。
  • 超過級別內用量後,單位價格會降低的 SKU。例如:1 至 100 個單位的價格為每個 $5 美元,101 至 1000 個單位的價格為每個 $4 美元,1001 個以上單位的價格為每個 $3 美元。

多層級定價注意事項:

  • 級別用量計數器會根據 SKU 的aggregation_interval (每日或每月) 歸零。

    • 每日 SKU 會在每天凌晨 12 點 (美國和加拿大太平洋時間,UTC-8 或 UTC-7) 重設。
    • 每月 SKU 會在每個日曆月 (例如 1 月、2 月等) 的第一天,於美國和加拿大太平洋時間 (UTC-8 或 UTC-7) 凌晨 12 點重設為零。
  • 各個 Cloud Billing 帳戶的級別獨立運作,不會跨多個 Cloud Billing 帳戶匯總,即使專案位於同一個組織或屬於同一個法人也一樣。

  • 各 SKU 的級別獨立運作:某個 SKU 的用量只會影響該 SKU 的價格。任何 SKU 的用量都不會影響其他 SKU 的分級定價。

  • 定價的 SKU 定價級別可能與合約價格的定價級別不完全一致。這種情況很少見。

  • 如果 SKU 有多個定價級別,則每個 SKU 級別價格會列在價目表的不同資料列中。您可以使用 tiered_rates.start_usage_amount 找出有多個定價級別的 SKU。

  • 視查詢編寫方式而定,您可以將 SKU 定價級別傳回為巢狀或非巢狀資料。如要進一步瞭解巢狀和非巢狀資料,請參閱 以下範例。

定價資料查詢範例

本節提供範例,說明如何查詢匯出至 BigQuery 的 Cloud Billing 定價資料。

本節提供多個範例,說明如何查詢匯出至 BigQuery 的 Cloud Billing 定價資料。

定價查詢範例中使用的常見值

本節的查詢範例使用下列值:

  • 資料表名稱:project.dataset.cloud_pricing_export
  • SKU ID:2DA5-55D3-E679 (Cloud Run - 要求)

取得特定 SKU 的定價

以下範例查詢會傳回指定 SKU 各定價層級的 list_price。

標準 SQL

SELECT sku.id,  sku.description, list_price.*
FROM `project.dataset.cloud_pricing_export`
WHERE DATE(_PARTITIONTIME) = "2020-07-20"
      AND sku.id = "2DA5-55D3-E679"
;

_PARTITIONTIME 是 BigQuery 自動生成的欄位,代表資料所屬的日期。您可以使用 Cloud Billing 匯出功能明確產生的欄位 (例如 pricing_as_of_time),而非 _PARTITIONTIME。

以下是設為使用 pricing_as_of_time 欄位的相同查詢:

SELECT sku.id,  sku.description, list_price.*
FROM `project.dataset.cloud_pricing_export`
WHERE DATE(pricing_as_of_time) = "2020-07-20"
      AND sku.id = "2DA5-55D3-E679"
;

查詢結果

列 id 說明 pricing_unit aggregation_info.
aggregation_level
aggregation_info.
aggregation_interval
tiered_rates.
pricing_unit_quantity
tiered_rates.
start_usage_amount
tiered_rates.
usd_amount
tiered_rates.
account_currency_amount
1 2DA5-55D3-E679 要求 COUNT ACCOUNT 每月 1000000 0 0 0
          1000000 2000000 0.4 0.4

取得特定 SKU 的定價,並加入服務說明

本節中的兩個範例示範了查詢,這些查詢會傳回指定 SKU 的每個定價層級的 list_price,並包含 SKU 說明和服務說明。

  • 範例 1 會在每列傳回一個 SKU,並以巢狀資料的形式顯示定價級別。
  • 範例 2 示範如何取消巢狀結構,為每個 SKU 的每個定價級別傳回一個資料列。

範例 1:傳回巢狀資料

這個範例會查詢單一 SKU,傳回 list_price 資料。這項 SKU 有多個定價級別。定價欄位值會顯示在 SKU ID 列下方的個別列中。

標準 SQL

SELECT sku.id AS sku_id,
       sku.description AS sku_description,
       service.id AS service_id,
       service.description as service_description,
       list_price.*
FROM my-billing-admin-project.my_billing_dataset.cloud_pricing_export
WHERE DATE(_PARTITIONTIME) = "2020-07-20"
      AND sku.id = "2DA5-55D3-E679"
;

查詢結果:

列 sku_id sku_description service_id service_description aggregation_info.
aggregation_level
aggregation_info.
aggregation_interval
tiered_rates.
pricing_unit_quantity
tiered_rates.
start_usage_amount
tiered_rates.
usd_amount
tiered_rates.
account_currency_amount
1 2DA5-55D3-E679 要求 152E-C115-5142 Cloud Run ACCOUNT 每月 1000000 0 0 0
            1000000 2000000 0.4 0.4

範例 2:傳回與同一資料表彙整的取消巢狀結構資料

這個範例會查詢單一 SKU,傳回 list price。SKU 有多個定價級別。這項查詢示範如何使用 UNNEST 運算子展開 tiered_rates 陣列,並將欄位與同一個資料表彙整,每個定價級別會產生一列。

標準 SQL

SELECT sku.id AS sku_id,
       sku.description AS sku_description,
       service.id AS service_id,
       service.description as service_description,
       tier.*
FROM `my-billing-admin-project.my_billing_dataset.cloud_pricing_export` as sku_pricing, UNNEST (sku_pricing.list_price.tiered_rates) as tier
WHERE DATE(_PARTITIONTIME) = "2020-07-20"
      AND sku.id = "2DA5-55D3-E679"
;

查詢結果:

列 sku_id sku_description service_id service_description pricing_unit_quantity start_usage_amount usd_amount account_currency_amount
1 2DA5-55D3-E679 要求 152E-C115-5142 Cloud Run 1000000.0 0.0 0.0 0.0
2 2DA5-55D3-E679 要求 152E-C115-5142 Cloud Run 1000000.0 2000000.0 0.4 0.4

使用產品分類和地理區域分類查詢 SKU

  • 產品分類:套用至 SKU 的產品類別清單,例如無伺服器、Cloud Run 或隨選 VM。
  • 地理分類是套用至 SKU 的地理中繼資料,由類型和區域值組成。

取得 SKU 的產品分類

以下範例示範如何查詢指定 SKU 的 product_taxonomy 清單,其中 SKU ID = 2DA5-55D3-E679 (Cloud Run - 要求)。

標準 SQL

SELECT sku.id AS sku_id,
       sku.description AS sku_description,
       service.id AS service_id,
       service.description as service_description,
       product_taxonomy
FROM `project.dataset.cloud_pricing_export`
WHERE DATE(_PARTITIONTIME) = "2020-07-20"
      AND sku.id = "2DA5-55D3-E679"
;

查詢結果:

列 sku_id sku_description service_id service_description product_taxonomy
1 2DA5-55D3-E679 要求 152E-C115-5142 Cloud Run GCP
        無伺服器
        Cloud Run
        其他

取得特定產品分類的所有 SKU

以下範例示範如何查詢,傳回符合指定 product_taxonomy 的所有 SKU。在這項查詢中,我們將 Serverless 指定為 product taxonomy 值。

標準 SQL

SELECT sku.id AS sku_id,
       sku.description AS sku_description,
       service.id AS service_id,
       service.description as service_description,
       product_taxonomy
FROM `project.dataset.cloud_pricing_export`
WHERE DATE(_PARTITIONTIME) = "2020-07-20"
     AND "Serverless" in UNNEST(product_taxonomy)
LIMIT 10
;

查詢結果:

列 sku_id sku_description service_id service_description product_taxonomy
1 0160-BD7B-4C40 Cloud Tasks 網路區域內輸出 F3A6-D7B7-9BDA Cloud Tasks GCP
        無伺服器
        Cloud Tasks
        其他
2 FE08-0A74-7AFD Cloud Tasks GOOGLE-API 輸出 F3A6-D7B7-9BDA Cloud Tasks GCP
        無伺服器
        Cloud Tasks
        其他
3 A81A-32A2-B46D 工作佇列儲存空間鹽湖城 F17B-412E-CB64 App Engine GCP
        無伺服器
        GAE
        其他
        TaskQueue

取得特定地理區域分類和產品分類的所有 SKU

以下範例查詢會傳回符合指定 geo_taxonomy 區域和指定 product_taxonomy 的所有 SKU,其中 region = us-east4,product_taxonomy = VMs On Demand。

標準 SQL

SELECT sku.id AS sku_id,
       sku.description AS sku_description,
       service.id AS service_id,
       service.description as service_description,
       geo_taxonomy,
       product_taxonomy
FROM `project.dataset.cloud_pricing_export`
WHERE DATE(_PARTITIONTIME) = "2020-07-20"
      AND "VMs On Demand" in UNNEST(product_taxonomy)
      AND geo_taxonomy.type = "REGIONAL"
      AND "us-east4" in UNNEST (geo_taxonomy.regions)
;

查詢結果:

列 sku_id sku_description service_id service_description geo_taxonomy.type geo_taxonomy.regions product_taxonomy
1 9174-81EE-425B 在維吉尼亞州執行的單一租戶執行個體 RAM 單一租戶附加費 6F81-5844-456A Compute Engine 區域 us-east4 GCP
            運算
            GCE
            隨選 VM
            記憶體:每 GB
2 C3B9-E891-85ED 在維吉尼亞州執行的單一租戶執行個體 RAM 6F81-5844-456A Compute Engine 區域 us-east4 GCP
            運算
            GCE
            隨選 VM
            記憶體:每 GB
3 6E2A-DCD9-87ED 在維吉尼亞州執行的 N1 預先定義執行個體 RAM 6F81-5844-456A Compute Engine 區域 us-east4 GCP
            運算
            GCE
            隨選 VM
            記憶體:每 GB

傳回有多個定價級別的 SKU 定價

您可依資料表名稱查詢 BigQuery 資料。查詢 FROM 子句中使用的資料表名稱,是根據三個值決定:project.dataset.BQ_table_name。

這些範例中使用的常見值:

  • 資料表名稱:project.dataset.cloud_pricing_export
  • SKU ID:2DA5-55D3-E679 (Cloud Run - 要求)

範例 1:傳回巢狀資料

這個範例會查詢單一 SKU,傳回 list_price 資料。這個 SKU 有多個定價級別。定價欄位值會顯示在 SKU ID 列下方的個別列中。

標準 SQL

SELECT sku.id AS sku_id,
       sku.description AS sku_description,
       service.id AS service_id,
       service.description as service_description,
       list_price.*
FROM my-billing-admin-project.my_billing_dataset.cloud_pricing_export
WHERE DATE(_PARTITIONTIME) = "2020-07-20"
      AND sku.id = "2DA5-55D3-E679"
;

查詢結果:

列 sku_id sku_description service_id service_description aggregation_info.
aggregation_level
aggregation_info.
aggregation_interval
tiered_rates.
pricing_unit_quantity
tiered_rates.
start_usage_amount
tiered_rates.
usd_amount
tiered_rates.
account_currency_amount
1 2DA5-55D3-E679 要求 152E-C115-5142 Cloud Run ACCOUNT 每月 1000000 0 0 0
            1000000 2000000 0.4 0.4

範例 2:傳回與同一資料表彙整的取消巢狀結構資料

這個範例會查詢單一 SKU,傳回 list price。SKU 有多個定價級別。這項查詢示範如何使用 UNNEST 運算子簡化 tiered_rates 陣列,並將欄位與相同資料表彙整,為每個定價層產生一個資料列。

標準 SQL

SELECT sku.id AS sku_id,
       sku.description AS sku_description,
       service.id AS service_id,
       service.description as service_description,
       tier.*
FROM `my-billing-admin-project.my_billing_dataset.cloud_pricing_export` as sku_pricing, UNNEST (sku_pricing.list_price.tiered_rates) as tier
WHERE DATE(_PARTITIONTIME) = "2020-07-20"
      AND sku.id = "2DA5-55D3-E679"
;

查詢結果:

列 sku_id sku_description service_id service_description pricing_unit_quantity start_usage_amount usd_amount account_currency_amount
1 2DA5-55D3-E679 要求 152E-C115-5142 Cloud Run 1000000.0 0.0 0.0 0.0
2 2DA5-55D3-E679 要求 152E-C115-5142 Cloud Run 1000000.0 2000000.0 0.4 0.4

Google Cloud 控制台提供費用和定價報表