イメージ ファミリーを使用して、イメージのバージョニングを簡略化します。イメージをイメージ ファミリーに追加し、最新のイメージ バージョンとして設定します。イメージ ファミリーを以前のイメージ バージョンにロールバックする必要があると判断した場合は、ファミリー内の最新のイメージの使用を中止します。
イメージ ファミリーを操作する際のベスト プラクティスについては、イメージ ファミリーのベスト プラクティスをご覧ください。
必要に応じて、Trusted Cloud コンソール、gcloud compute images create
コマンドと --storage-location
フラグ、または images().insert
メソッドを使用して、イメージの保存先を指定できます。
始める前に
- Images ドキュメントを確認します。
-
まだ設定していない場合は、認証を設定します。認証とは、 Trusted Cloud by S3NS サービスと API にアクセスするために ID を確認するプロセスです。ローカル開発環境からコードまたはサンプルを実行するには、次のいずれかのオプションを選択して Compute Engine に対する認証を行います。
Select the tab for how you plan to use the samples on this page:
Console
When you use the Trusted Cloud console to access Trusted Cloud by S3NS services and APIs, you don't need to set up authentication.
gcloud
-
After installing the Google Cloud CLI, sign in to the gcloud CLI with your federated identity and then initialize it by running the following command:
gcloud init
- Set a default region and zone.
Trusted Cloud コンソールで、[イメージの作成] ページに移動します。
イメージの [名前] を指定します。例:
image-v1
イメージ作成元の [ソース] を指定します。永続ディスク、スナップショット、別のイメージまたは Cloud Storage 内の disk.raw ファイルが指定できます
実行中の VM にアタッチされたディスクからイメージを作成する場合、[インスタンスを実行し続ける] をオンにして、VM の実行中にイメージを作成することを確認します。イメージを作成する前に VM を準備できます。
[ソースディスクのロケーションに基づく(デフォルト)] プルダウン リストで、イメージを保存するロケーションを指定します。たとえば、イメージを
us
マルチリージョンに保存するにはus
を指定し、us-central1
リージョンに保存するにはus-central1
を指定します。選択しない場合、Compute Engine はイメージのソースのロケーションに最も近いマルチリージョンにイメージを保存します。新しいイメージの、イメージ ファミリーを指定します。たとえば、
my-image-family
を追加してイメージ ファミリーの一部としてイメージを管理します。省略可: 他のイメージ プロパティを指定します。
- 説明: カスタム イメージの説明。
- ラベル: リソースをグループ化するラベル。
暗号鍵を指定します。 Google Cloud-powered encryption key、Cloud Key Management Service(Cloud KMS)鍵、顧客指定の暗号鍵(CSEK)のいずれかを選択できます。暗号鍵が指定されていない場合、イメージは Google Cloud-powered encryption keyを使用して暗号化されます。
[作成] をクリックしてイメージを作成します。
REST
このページの REST API サンプルをローカル開発環境で使用するには、gcloud CLI に指定した認証情報を使用します。
After installing the Google Cloud CLI, sign in to the gcloud CLI with your federated identity and then initialize it by running the following command:
gcloud init
詳細については、 Trusted Cloud 認証ドキュメントの REST を使用して認証するをご覧ください。
イメージ ファミリーでイメージ バージョンを設定する
コンソール
gcloud
gcloud compute images create image-v1 \ --source-disk disk-1 \ --source-disk-zone us-central1-f \ --family my-image-family
イメージ ファミリーは
image-v1
をポイントします。2 つ目のイメージをファミリーに追加します。gcloud compute images create image-v2 \ --source-disk disk-2 \ --source-disk-zone us-central1-f \ --family my-image-family
REST
images().insert
メソッドにPOST
リクエストを送信します。リクエストの本文にイメージ ファミリーを指定します。POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/images { "name": "image-v2", "sourceDisk": "/zones/us-central1-f/disks/disk-2", "family":"my-image-family", }
image-v2
はイメージ ファミリーに追加した最新のイメージであるため、イメージ ファミリーではこのイメージがポイントされます。gcloud
gcloud compute images describe-from-family
コマンドを実行して、ファミリーでどのイメージがポイントされるかを確認できます。例:
gcloud compute images describe-from-family my-image-family family: my-image-family id: '8904691942610171306' kind: compute#image name: image-v2 selfLink: https://compute.googleapis.com/compute/v1/projects/my-project/global/images/image-v2 sourceDisk: https://compute.googleapis.com/compute/v1/projects/my-project/zones/us-central1-f/disks/disk-v2 sourceDiskId: '1677449456001963379' sourceType: RAW status: READY
REST
images().getFromFamily
メソッドにGET
リクエストを送信します。リクエストの本文にイメージ ファミリーを指定します。GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/images/family { "resourceId":"my-image-family", }
イメージ ファミリーをロールバックして
image-v2
をポイントしなくなるようにする必要があると判断した場合は、image-v2
を使用中止にすると、ファミリーは再びimage-v1
をポイントします。gcloud compute images deprecate image-v2 \ --state DEPRECATED \ --replacement image-v1
イメージ ファミリーが
image-v1
をポイントしていることを確認します。gcloud compute images describe-from-family my-image-family family: my-image-family id: '2741732787056801255' kind: compute#image name: image-v1 selfLink: https://compute.googleapis.com/compute/v1/projects/my-project/global/images/image-v1 sourceDisk: https://compute.googleapis.com/compute/v1/projects/my-project/zones/us-central1-f/disks/disk-v1 sourceDiskId: '1677449456001963379' sourceType: RAW status: READY
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-21 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-21 UTC。"],[[["Image families simplify image versioning by allowing you to group related images and designate the most recent version."],["Adding a new image to an existing image family automatically sets it as the newest version within that family."],["You can manage the storage location of an image during creation using the Google Cloud console, the `gcloud compute images create` command, or the `images().insert` method."],["Rolling back to a previous image version involves deprecating the most recent image, which then reverts the family's pointer to the prior version."],["The `gcloud compute images describe-from-family` command or the `images().getFromFamily` method allows you to confirm which image a specific image family currently references."]]],[]] -