目前,您只能透過 API 購買特定產品的支出承諾。本文將說明如何購買按照支出計算的承諾使用合約。
事前準備
為 Google Cloud 專案啟用 Cloud Commerce Consumer Procurement API。
請確認您在要用來購買承諾方案的 Cloud Billing 帳戶中,具備下列其中一個 Identity and Access Management (IAM) 角色:
找出要購買的商品
如要購買以支出為依據的承諾,請使用「優惠名稱」來表示您購買的產品和折扣期限。
以下優惠可供購買:
產品 | 字詞 | 方案名稱 |
---|---|---|
AlloyDB for PostgreSQL | 1 年 | services/alloydb.googleapis.com/standardOffers/adbca020-a973-48c9-b9b6-f5d70527790c |
AlloyDB for PostgreSQL | 3 年 | services/alloydb.googleapis.com/standardOffers/56e5948f-f1ed-45ce-84d6-a8408092e7d5 |
GKE 備份 | 1 年 | services/gkebackup.googleapis.com/standardOffers/89852607-f073-4696-94cc-de7ed85f27c7 |
GKE 備份 | 3 年 | services/gkebackup.googleapis.com/standardOffers/25d2877b-2868-4312-b54e-880896a119c5 |
備份和災難復原 | 1 年 | services/backupdr.googleapis.com/standardOffers/30c7e770-724f-4a7d-8369-b726a397b53a |
備份和災難復原 | 3 年 | services/backupdr.googleapis.com/standardOffers/6748e93c-4114-4fa2-bf3e-cb4d3534bb48 |
BigQuery | 1 年 | services/bigqueryreservation.googleapis.com/standardOffers/6e72d4d4-5591-4c7f-aa9f-88d277d9280c |
BigQuery | 3 年 | services/bigqueryreservation.googleapis.com/standardOffers/ad5539c4-a0d9-4abd-82c9-1104a7c8ad64 |
Bigtable | 1 年 | services/bigtable.googleapis.com/standardOffers/5a0a5567-1552-445e-9f1b-f1ac69fb0f39 |
Bigtable | 3 年 | services/bigtable.googleapis.com/standardOffers/26e8485e-acef-4e73-9a13-f0b2109befff |
Cloud Run | 1 年 | services/run.googleapis.com/standardOffers/55435965-baf5-485f-baea-3fde53566e5e |
Cloud Run | 3 年 | services/run.googleapis.com/standardOffers/a8b22b6c-2992-48d3-9b73-98fc7a47d61c |
Compute Engine 彈性使用承諾 | 1 年 | services/compute.googleapis.com/standardOffers/ffe0f6a3-2f98-437e-8d49-fc443a05d3c2 |
Compute Engine 彈性使用承諾 | 3 年 | services/compute.googleapis.com/standardOffers/062a285d-8989-4ce7-8f9a-bed8d183236f |
Google Kubernetes Engine | 1 年 | services/container.googleapis.com/standardOffers/ae2672e6-47a8-41dc-9448-6956d7f4fbc1 |
Google Kubernetes Engine | 3 年 | services/container.googleapis.com/standardOffers/fcf378c1-fbe0-4aaa-b05e-9597f8b45578 |
Dataflow | 1 年 | services/dataflow.googleapis.com/standardOffers/42ae4415-0361-404f-8bc5-1e7c041c2d82 |
Dataflow | 3 年 | services/dataflow.googleapis.com/standardOffers/cac998b8-3d49-4672-ae5b-e5b3c56e05f2 |
Managed Service for Apache Kafka | 1 年 | services/managedkafka.googleapis.com/standardOffers/e1636f7d-1a29-4d53-a89e-c1f60e8dadcf |
Managed Service for Apache Kafka | 3 年 | services/managedkafka.googleapis.com/standardOffers/31d79333-0c0e-4208-9b20-c6e4f27e5d1d |
Memorystore | 1 年 | services/redis.googleapis.com/standardOffers/fe93270a-f338-4a76-b303-c323608a9d37 |
Memorystore | 3 年 | services/redis.googleapis.com/standardOffers/8f20579e-7630-4592-8fa6-0d7d3b749354 |
NetApp Volumes | 1 年 | services/netapp.googleapis.com/standardOffers/90520cfa-14b6-42ae-92b9-129671bf2aca |
NetApp Volumes | 3 年 | services/netapp.googleapis.com/standardOffers/c852fef8-e699-4524-90f4-e7b89edeb33c |
Spanner | 1 年 | services/spanner.googleapis.com/standardOffers/29829e5f-681c-4810-a471-8e4611a8042b |
Spanner | 3 年 | services/spanner.googleapis.com/standardOffers/709f6c69-8a49-4032-97f7-ce21fe340603 |
Cloud SQL | 1 年 | services/cloudsql.googleapis.com/standardOffers/266e6a8c-2a0d-4b92-af9c-5795760f1fc9 |
Cloud SQL | 3 年 | services/cloudsql.googleapis.com/standardOffers/4998bf0a-51dd-4ce0-8405-aa529dd86d33 |
找出優惠參數
承諾有兩個參數:
- 承諾金額 (
hourly_commit
):購買這項承諾後,每小時會套用至 Cloud Billing 帳戶的抵免額。 - 區域 (
region
):此承諾適用的抵免額所屬區域。
購買承諾時,您必須指定這兩個參數。
購買優惠
如要購買優惠,請呼叫 billingAccounts.orders.place
,並提供下列參數:
hourly_commit
表示承諾的美元價值。購買承諾產品的
region
。
如要下單,請執行下列指令:
curl 'https://cloudcommerceconsumerprocurement.googleapis.com/v1alpha1/billingAccounts/BILLING_ACCOUNT_ID/orders:place' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'X-Goog-User-Project: CONSUMER_PROJECT_ID' \
-d '@-' <<EOF
{
"displayName": "DISPLAY_NAME",
"lineItemInfo": [{
"parameters": [{
"name": "hourly_commit",
"value": {
"doubleValue": HOURLY_COMMIT
}
}, {
"name": "region",
"value": {
"stringValue": "REGION"
}
}],
"offer": "OFFER_NAME"
}]
}
EOF
這會傳回長時間執行作業的名稱:
{
"name": "OPERATION_NAME"
}
如要確認已傳回的長時間運作作業是否順利完成,請執行下列指令:
curl 'https://cloudcommerceconsumerprocurement.googleapis.com/v1alpha1/OPERATION_NAME' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'X-Goog-User-Project: CONSUMER_PROJECT_ID'
長時間執行的作業應在一秒內完成。
查看訂單
您可以直接在 Google Cloud 控制台中查看承諾的目前狀態,也可以呼叫 billingAccounts.orders.get
。建立的 Order 的 name
欄位會指定 Order 名稱。
cURL
如要查看訂單,請執行下列指令:
curl 'https://cloudcommerceconsumerprocurement.googleapis.com/v1alpha1/ORDER_NAME' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'X-Goog-User-Project: CONSUMER_PROJECT_ID'
控制台
- 前往 https://console.cloud.google.com/billing。
- 選取 Cloud Billing 帳戶。
- 在側欄中選取「承諾」。
- 您購買的承諾會顯示在表格中。