【アップデート】Compute EngineのSpot VMの可用性・プリエンプション率をリアルタイム確認できるようになりました

【アップデート】Compute EngineのSpot VMの可用性・プリエンプション率をリアルタイム確認できるようになりました

2026.06.17

はじめに

こんにちは。
クラウド事業本部コンサルティング部の渡邉です。

2026年6月15日、Compute Engine で Spot VM の可用性・推定稼働時間・プリエンプション率・価格履歴をリアルタイムに確認できる機能 が Preview として公開されました。

https://docs.cloud.google.com/compute/docs/release-notes

https://docs.cloud.google.com/compute/docs/instances/view-vm-availability

https://docs.cloud.google.com/compute/docs/instances/view-spot-preemption-price

Spot VM はオンデマンド比で最大 91% オフという圧倒的なコスト優位性がある一方で、「実際に取得できるかわからない」、「どれくらい安定して動くかわからない」という課題があると思います。
今回の機能追加により、Spot VM を作成する前に可用性スコアや稼働時間の見通しを確認できるようになりました。

追加された 2 つの API

今回追加された機能は、以下の 2 つの API で構成されています。

API 取得できる情報 用途
advice.capacity リアルタイムの可用性スコア・推定稼働時間 VM 作成前の事前確認
advice.capacityHistory 過去 30 日のプリエンプション率・過去 1 年の価格推移 マシンタイプ・ゾーンの比較検討

advice.capacity : 取得可能性スコアと推定稼働時間

取得可能性スコア(Obtainability score)は、0.0〜1.0 の数値でリアルタイムの可用性を表します。
公式ドキュメント上では、スコアの値による評価として以下のように記述されていました。

スコア 意味
0.7〜1.0 高い成功確率
0.4〜0.6 中程度の成功確率
0.0〜0.3 低い成功確率(別ゾーン・マシンタイプを推奨)

推定稼働時間(Estimated uptime)は、3 段階の離散値で稼働時間の見通しを示します。

意味
3600 秒(60 分) ほとんどの Spot VM が 1 時間以上稼働見込み
600 秒(10 分) ほとんどの Spot VM が 10 分以上稼働見込み
60 秒(1 分) ほとんどの Spot VM が 1 分程度で停止見込み(別構成を強く推奨)

advice.capacityHistory : プリエンプション率と価格履歴

情報 内容
過去 30 日のプリエンプション率 日次データ。0.0〜1.0(例:0.52 = 52% がプリエンプション)。プリエンプション率の算出式:その日にプリエンプションされた Spot VM 数 ÷ その日に停止した Spot VM 数
過去 1 年の価格推移 時間帯ごとの USD 価格

対応マシンタイプと制限事項

本機能は汎用・コンピュート・メモリ最適化マシンタイプを幅広くカバーしていますが、一部の構成については制限があります。

項目 対応状況
汎用・コンピュート・メモリ最適化マシンタイプ
GPU アタッチ N1 マシン REST API のみ(Console・gcloud 不可)
Local SSD REST API のみ(Console・gcloud 不可)
TPU × 非対応
カスタムマシンタイプ capacityHistory 非対応
A4X Max・A4X Spot 自体が非対応

実際に試してみる

前提条件

  • gcloud CLI がインストール済みであること(beta コンポーネントを含む)
  • 対象プロジェクトで Compute Engine API が有効化済みであること
  • roles/compute.viewer(Compute Viewer)ロールが付与されていること

ステップ 1: Spot VM の可用性を確認する(advice.capacity)

gcloud beta compute advice capacity コマンドでリアルタイム可用性を確認します。

gcloud beta compute advice capacity \
    --provisioning-model=SPOT \
    --instance-selection-machine-types=e2-medium,e2-standard-4,e2-standard-8 \
    --target-distribution-shape=BALANCED \
    --size=10 \
    --region=asia-northeast1

パラメータの説明

パラメータ 説明
--instance-selection-machine-types カンマ区切りで最大 5 種類列挙可能(例:n2-standard-2,n2-standard-4
--target-distribution-shape Spot VMの配置方法の指定 ANY(バッチ向け)/ ANY_SINGLE_ZONE(AI/HPC 向け)/ BALANCED(高可用サービング向け)
--size 起動したい VM 台数
--region 対象リージョン(例:us-central1
recommendations:
- scores:
    estimatedUptime: 3600s
    obtainability: 0.9
  shards:
  - instanceCount: 3
    machineType: e2-medium
    provisioningModel: SPOT
    zone: https://www.googleapis.com/compute/beta/projects/YOUR_PROJECT_ID/zones/asia-northeast1-a
  - instanceCount: 3
    machineType: e2-medium
    provisioningModel: SPOT
    zone: https://www.googleapis.com/compute/beta/projects/YOUR_PROJECT_ID/zones/asia-northeast1-b
  - instanceCount: 4
    machineType: e2-medium
    provisioningModel: SPOT
    zone: https://www.googleapis.com/compute/beta/projects/YOUR_PROJECT_ID/zones/asia-northeast1-c

取得可能性スコア 0.9(高い成功確率)、推定稼働時間 3600 秒(ほとんどの VM が 60 分以上稼働見込み)という結果です。e2-medium で合計 10 台を asia-northeast1 の 3 ゾーンにバランスよく分散(a ゾーン: 3 台、b ゾーン: 3 台、c ゾーン: 4 台)するよう推奨されています。

--target-distribution-shape=BALANCED を指定したため、単一ゾーン障害に備えてリージョン内のゾーン間で分散配置されています。もし ANY_SINGLE_ZONE を指定していた場合は、最も可用性が高い 1 ゾーンに集約された推奨が返ります。

ステップ 2: プリエンプション率と価格履歴を確認する(advice.capacityHistory)

gcloud beta compute advice capacity-history \
    --provisioning-model=SPOT \
    --machine-type=e2-medium \
    --types=PREEMPTION,PRICE \
    --region=asia-northeast1
location: https://www.googleapis.com/compute/beta/projects/YOUR_PROJECT_ID/regions/asia-northeast1
machineType: e2-medium
preemptionHistory:
- interval:
    endTime: '2026-05-05T07:00:00Z'
    startTime: '2026-03-18T07:00:00Z'
  preemptionRate: 0.0
- interval:
    endTime: '2026-05-06T07:00:00Z'
    startTime: '2026-05-05T07:00:00Z'
  preemptionRate: 0.48
- interval:
    endTime: '2026-05-07T07:00:00Z'
    startTime: '2026-05-06T07:00:00Z'
  preemptionRate: 0.73
- interval:
    endTime: '2026-05-08T07:00:00Z'
    startTime: '2026-05-07T07:00:00Z'
  preemptionRate: 0.65
- interval:
    endTime: '2026-05-09T07:00:00Z'
    startTime: '2026-05-08T07:00:00Z'
  preemptionRate: 0.57
- interval:
    endTime: '2026-05-10T07:00:00Z'
    startTime: '2026-05-09T07:00:00Z'
  preemptionRate: 0.33
- interval:
    endTime: '2026-05-11T07:00:00Z'
    startTime: '2026-05-10T07:00:00Z'
  preemptionRate: 0.44
- interval:
    endTime: '2026-05-12T07:00:00Z'
    startTime: '2026-05-11T07:00:00Z'
  preemptionRate: 0.5
- interval:
    endTime: '2026-05-13T07:00:00Z'
    startTime: '2026-05-12T07:00:00Z'
  preemptionRate: 0.34
- interval:
    endTime: '2026-05-14T07:00:00Z'
    startTime: '2026-05-13T07:00:00Z'
  preemptionRate: 0.47
- interval:
    endTime: '2026-05-15T07:00:00Z'
    startTime: '2026-05-14T07:00:00Z'
  preemptionRate: 0.39
- interval:
    endTime: '2026-05-16T07:00:00Z'
    startTime: '2026-05-15T07:00:00Z'
  preemptionRate: 0.33
- interval:
    endTime: '2026-05-17T07:00:00Z'
    startTime: '2026-05-16T07:00:00Z'
  preemptionRate: 0.44
- interval:
    endTime: '2026-05-18T07:00:00Z'
    startTime: '2026-05-17T07:00:00Z'
  preemptionRate: 0.35
- interval:
    endTime: '2026-05-19T07:00:00Z'
    startTime: '2026-05-18T07:00:00Z'
  preemptionRate: 0.27
- interval:
    endTime: '2026-05-20T07:00:00Z'
    startTime: '2026-05-19T07:00:00Z'
  preemptionRate: 0.34
- interval:
    endTime: '2026-05-21T07:00:00Z'
    startTime: '2026-05-20T07:00:00Z'
  preemptionRate: 0.35
- interval:
    endTime: '2026-05-22T07:00:00Z'
    startTime: '2026-05-21T07:00:00Z'
  preemptionRate: 0.23
- interval:
    endTime: '2026-05-23T07:00:00Z'
    startTime: '2026-05-22T07:00:00Z'
  preemptionRate: 0.18
- interval:
    endTime: '2026-05-24T07:00:00Z'
    startTime: '2026-05-23T07:00:00Z'
  preemptionRate: 0.33
- interval:
    endTime: '2026-05-25T07:00:00Z'
    startTime: '2026-05-24T07:00:00Z'
  preemptionRate: 0.42
- interval:
    endTime: '2026-05-26T07:00:00Z'
    startTime: '2026-05-25T07:00:00Z'
  preemptionRate: 0.38
- interval:
    endTime: '2026-05-27T07:00:00Z'
    startTime: '2026-05-26T07:00:00Z'
  preemptionRate: 0.34
- interval:
    endTime: '2026-05-28T07:00:00Z'
    startTime: '2026-05-27T07:00:00Z'
  preemptionRate: 0.18
- interval:
    endTime: '2026-05-29T07:00:00Z'
    startTime: '2026-05-28T07:00:00Z'
  preemptionRate: 0.15
- interval:
    endTime: '2026-05-30T07:00:00Z'
    startTime: '2026-05-29T07:00:00Z'
  preemptionRate: 0.39
- interval:
    endTime: '2026-05-31T07:00:00Z'
    startTime: '2026-05-30T07:00:00Z'
  preemptionRate: 0.19
- interval:
    endTime: '2026-06-01T07:00:00Z'
    startTime: '2026-05-31T07:00:00Z'
  preemptionRate: 0.25
- interval:
    endTime: '2026-06-03T07:00:00Z'
    startTime: '2026-06-01T07:00:00Z'
  preemptionRate: 0.27
- interval:
    endTime: '2026-06-04T07:00:00Z'
    startTime: '2026-06-03T07:00:00Z'
  preemptionRate: 0.2
- interval:
    endTime: '2026-06-05T07:00:00Z'
    startTime: '2026-06-04T07:00:00Z'
  preemptionRate: 0.28
- interval:
    endTime: '2026-06-06T07:00:00Z'
    startTime: '2026-06-05T07:00:00Z'
  preemptionRate: 0.13
- interval:
    endTime: '2026-06-07T07:00:00Z'
    startTime: '2026-06-06T07:00:00Z'
  preemptionRate: 0.1
- interval:
    endTime: '2026-06-08T07:00:00Z'
    startTime: '2026-06-07T07:00:00Z'
  preemptionRate: 0.28
- interval:
    endTime: '2026-06-09T07:00:00Z'
    startTime: '2026-06-08T07:00:00Z'
  preemptionRate: 0.31
- interval:
    endTime: '2026-06-10T07:00:00Z'
    startTime: '2026-06-09T07:00:00Z'
  preemptionRate: 0.3
- interval:
    endTime: '2026-06-11T07:00:00Z'
    startTime: '2026-06-10T07:00:00Z'
  preemptionRate: 0.18
- interval:
    endTime: '2026-06-12T07:00:00Z'
    startTime: '2026-06-11T07:00:00Z'
  preemptionRate: 0.19
- interval:
    endTime: '2026-06-13T07:00:00Z'
    startTime: '2026-06-12T07:00:00Z'
  preemptionRate: 0.24
- interval:
    endTime: '2026-06-14T07:00:00Z'
    startTime: '2026-06-13T07:00:00Z'
  preemptionRate: 0.19
- interval:
    endTime: '2026-06-15T07:00:00Z'
    startTime: '2026-06-14T07:00:00Z'
  preemptionRate: 0.34
- interval:
    endTime: '2026-06-16T07:00:00Z'
    startTime: '2026-06-15T07:00:00Z'
  preemptionRate: 0.44
priceHistory:
- interval:
    endTime: '2026-04-13T07:00:00Z'
    startTime: '2026-04-08T07:00:00Z'
  listPrice:
    currencyCode: USD
    nanos: 31072000
- interval:
    endTime: '2026-04-27T07:00:00Z'
    startTime: '2026-04-13T07:00:00Z'
  listPrice:
    currencyCode: USD
    nanos: 32620000
- interval:
    endTime: '2026-05-11T07:00:00Z'
    startTime: '2026-04-27T07:00:00Z'
  listPrice:
    currencyCode: USD
    nanos: 34244000
- interval:
    endTime: '2026-06-09T07:00:00Z'
    startTime: '2026-05-11T07:00:00Z'
  listPrice:
    currencyCode: USD
    nanos: 35500000

結果から読み取れる内容

プリエンプション率の傾向

期間 プリエンプション率の傾向
〜2026-05-04 0.0(プリエンプションなし)
2026-05-05〜09 急上昇スパイク(最大 0.73)
2026-05-10〜6月上旬 0.10〜0.50 前後に落ち着く
2026-06-06〜07 0.10(期間最低値)
2026-06-15〜16(直近) 0.44(再び上昇傾向)
  • 5/5〜5/9 の急騰preemptionRate: 0.73(その日に停止した VM の 73% がプリエンプション由来)に達しており、リージョン全体で容量が逼迫していたことを示しています。こういった過去の荒れ期間を確認できるのがこの API の大きなメリットです。
  • 6 月上旬(6/6〜7)は 0.10 と安定していましたが、直近(6/15〜16)は 0.44 と上昇しています。Spot VM 利用前に必ず直近の傾向を確認することが重要です。

価格履歴の読み方

listPrice.nanos は 1 時間あたりの USD をナノ単位(÷ 10⁹)で表しています。

期間 1 時間あたりの料金
2026-04-08〜04-13 $0.031072
2026-04-13〜04-27 $0.032620
2026-04-27〜05-11 $0.034244
2026-05-11〜06-09 $0.035500

約 2 ヶ月で $0.031 → $0.036 と約 14% の価格上昇が確認できます。Spot VM の価格は動的に変動するため、このような価格推移をモニタリングしてコスト計画の見直しに活用できます。

ゾーン単位でプリエンプション率のみ確認したい場合は --zone=ZONE で指定します。

gcloud beta compute advice capacity-history \
    --provisioning-model=SPOT \
    --machine-type=e2-medium \
    --types=PREEMPTION \
    --zone=asia-northeast1-a
location: https://www.googleapis.com/compute/beta/projects/YOUR_PROJECT_ID/zones/asia-northeast1-a
machineType: e2-medium
preemptionHistory:
- interval:
    endTime: '2026-05-10T07:00:00Z'
    startTime: '2026-03-18T07:00:00Z'
  preemptionRate: 0.0
- interval:
    endTime: '2026-05-11T07:00:00Z'
    startTime: '2026-05-10T07:00:00Z'
  preemptionRate: 0.53
- interval:
    endTime: '2026-05-12T07:00:00Z'
    startTime: '2026-05-11T07:00:00Z'
  preemptionRate: 0.6
- interval:
    endTime: '2026-05-13T07:00:00Z'
    startTime: '2026-05-12T07:00:00Z'
  preemptionRate: 0.5
- interval:
    endTime: '2026-05-14T07:00:00Z'
    startTime: '2026-05-13T07:00:00Z'
  preemptionRate: 0.65
- interval:
    endTime: '2026-05-15T07:00:00Z'
    startTime: '2026-05-14T07:00:00Z'
  preemptionRate: 0.57
- interval:
    endTime: '2026-05-16T07:00:00Z'
    startTime: '2026-05-15T07:00:00Z'
  preemptionRate: 0.21
- interval:
    endTime: '2026-05-17T07:00:00Z'
    startTime: '2026-05-16T07:00:00Z'
  preemptionRate: 0.33
- interval:
    endTime: '2026-05-18T07:00:00Z'
    startTime: '2026-05-17T07:00:00Z'
  preemptionRate: 0.44
- interval:
    endTime: '2026-05-19T07:00:00Z'
    startTime: '2026-05-18T07:00:00Z'
  preemptionRate: 0.33
- interval:
    endTime: '2026-05-20T07:00:00Z'
    startTime: '2026-05-19T07:00:00Z'
  preemptionRate: 0.38
- interval:
    endTime: '2026-05-21T07:00:00Z'
    startTime: '2026-05-20T07:00:00Z'
  preemptionRate: 0.47
- interval:
    endTime: '2026-05-22T07:00:00Z'
    startTime: '2026-05-21T07:00:00Z'
  preemptionRate: 0.32
- interval:
    endTime: '2026-05-23T07:00:00Z'
    startTime: '2026-05-22T07:00:00Z'
  preemptionRate: 0.11
- interval:
    endTime: '2026-05-24T07:00:00Z'
    startTime: '2026-05-23T07:00:00Z'
  preemptionRate: 0.08
- interval:
    endTime: '2026-05-25T07:00:00Z'
    startTime: '2026-05-24T07:00:00Z'
  preemptionRate: 0.43
- interval:
    endTime: '2026-05-26T07:00:00Z'
    startTime: '2026-05-25T07:00:00Z'
  preemptionRate: 0.52
- interval:
    endTime: '2026-05-27T07:00:00Z'
    startTime: '2026-05-26T07:00:00Z'
  preemptionRate: 0.5
- interval:
    endTime: '2026-05-28T07:00:00Z'
    startTime: '2026-05-27T07:00:00Z'
  preemptionRate: 0.24
- interval:
    endTime: '2026-05-29T07:00:00Z'
    startTime: '2026-05-28T07:00:00Z'
  preemptionRate: 0.15
- interval:
    endTime: '2026-05-30T07:00:00Z'
    startTime: '2026-05-29T07:00:00Z'
  preemptionRate: 0.49
- interval:
    endTime: '2026-05-31T07:00:00Z'
    startTime: '2026-05-30T07:00:00Z'
  preemptionRate: 0.16
- interval:
    endTime: '2026-06-01T07:00:00Z'
    startTime: '2026-05-31T07:00:00Z'
  preemptionRate: 0.27
- interval:
    endTime: '2026-06-02T07:00:00Z'
    startTime: '2026-06-01T07:00:00Z'
  preemptionRate: 0.33
- interval:
    endTime: '2026-06-03T07:00:00Z'
    startTime: '2026-06-02T07:00:00Z'
  preemptionRate: 0.37
- interval:
    endTime: '2026-06-04T07:00:00Z'
    startTime: '2026-06-03T07:00:00Z'
  preemptionRate: 0.25
- interval:
    endTime: '2026-06-05T07:00:00Z'
    startTime: '2026-06-04T07:00:00Z'
  preemptionRate: 0.41
- interval:
    endTime: '2026-06-06T07:00:00Z'
    startTime: '2026-06-05T07:00:00Z'
  preemptionRate: 0.18
- interval:
    endTime: '2026-06-07T07:00:00Z'
    startTime: '2026-06-06T07:00:00Z'
  preemptionRate: 0.08
- interval:
    endTime: '2026-06-08T07:00:00Z'
    startTime: '2026-06-07T07:00:00Z'
  preemptionRate: 0.39
- interval:
    endTime: '2026-06-09T07:00:00Z'
    startTime: '2026-06-08T07:00:00Z'
  preemptionRate: 0.3
- interval:
    endTime: '2026-06-10T07:00:00Z'
    startTime: '2026-06-09T07:00:00Z'
  preemptionRate: 0.32
- interval:
    endTime: '2026-06-12T07:00:00Z'
    startTime: '2026-06-10T07:00:00Z'
  preemptionRate: 0.19
- interval:
    endTime: '2026-06-13T07:00:00Z'
    startTime: '2026-06-12T07:00:00Z'
  preemptionRate: 0.25
- interval:
    endTime: '2026-06-14T07:00:00Z'
    startTime: '2026-06-13T07:00:00Z'
  preemptionRate: 0.16
- interval:
    endTime: '2026-06-15T07:00:00Z'
    startTime: '2026-06-14T07:00:00Z'
  preemptionRate: 0.47
- interval:
    endTime: '2026-06-16T07:00:00Z'
    startTime: '2026-06-15T07:00:00Z'
  preemptionRate: 0.61

ゾーン別で見ると、asia-northeast1-a の直近(6/15〜16)のプリエンプション率は 0.61 と、リージョン全体の 0.44 を大幅に上回っています。同じリージョン内でもゾーンによって容量の逼迫具合が異なるため、--target-distribution-shape=BALANCED で複数ゾーンに分散させる戦略が有効なことがデータからも確認できます。

Cloud Console で確認する

  1. Google Cloud Console で 「Capacity advisor」 ページを開く
  2. フィルターペインで Locationマシンタイプ(最大 5 種類)・VM 台数 を設定
  3. 「検索」 をクリック

Capacity Advisor の検索結果画面
Capacity Advisor の検索結果画面

マップ上に asia-northeast1 の各ゾーンがハイライトされ、右側のパネルにゾーンごとの詳細情報が表示されます。e2-standard-4 を選択すると、以下の情報がパネルに表示されました。

項目
VM の可能性
過去のプリエンプション率 20%+
1 時間あたりの料金 $0.08596

ゾーン情報(asia-northeast1)

ゾーン VM 可用性 過去のプリエンプション率
asia-northeast1-a 20%+
asia-northeast1-b 20%+
asia-northeast1-c 20%+

3 ゾーンいずれも可用性が「高」と表示されており、今回の e2-standard ファミリーは asia-northeast1 リージョンで安定して取得できる状態でした。リスト表示に切り替えると、マシンタイプ別・ゾーン別の比較がより見やすくなります。

まとめ

今回 Preview として公開された機能により、advice.capacity API でリアルタイムの取得可能性スコア(0.0〜1.0)と推定稼働時間(60 / 600 / 3600 秒)を、advice.capacityHistory API で過去 30 日のプリエンプション率と過去 1 年の価格推移を確認できるようになりました。Cloud Console(Capacity advisor)・gcloud beta・REST API の 3 つの方法で利用できます。

「Spot VM は安いけど安定して取れるかわからない」という課題に対して、この機能はデータドリブンな意思決定の手段を提供します。数百台を一括起動する大規模バッチ処理であれば事前にスコアを確認してリソース可用性エラーを回避できますし、ML トレーニングであれば推定稼働時間を参考にチェックポイント保存頻度を調整してプリエンプション時のロールバック量を最小化できます。また、複数マシンタイプのプリエンプション率と価格履歴を比較することで、コストパフォーマンスの高い構成をデータから選べます。

この記事が誰かの助けになれば幸いです。

以上、クラウド事業本部コンサルティング部の渡邉でした!

この記事をシェアする

関連記事