削除できるカスタム イメージは、プロジェクトへのアクセス権を持つ他のユーザーまたは自分が追加したカスタム イメージのみです。
始める前に
- Images ドキュメントを確認します。
-
まだ設定していない場合は、認証を設定します。認証とは、サービスと API にアクセスするために ID を確認するプロセスです。 Google Cloud ローカル開発環境からコードまたはサンプルを実行するには、次のいずれかのオプションを選択して Compute Engine に対する認証を行います。
Select the tab for how you plan to use the samples on this page:
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
-
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
- Set a default region and zone.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
Python
ローカル開発環境でこのページの Python サンプルを使用するには、gcloud CLI をインストールして初期化し、ユーザー認証情報を使用してアプリケーションのデフォルト認証情報を設定します。
詳細については Set up authentication for a local development environment をご覧ください。
REST
このページの REST API サンプルをローカル開発環境で使用するには、gcloud CLI に指定した認証情報を使用します。
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
詳細については、 Google Cloud 認証ドキュメントの REST を使用して認証するをご覧ください。
-
カスタム イメージの削除
次のいずれかの方法で画像を削除します。
Google Cloud コンソールで、[イメージ] ページに移動します。
削除するイメージの左側にあるチェックボックスをオンにします。
ページの上部にある [削除] をクリックします。イメージは削除されます。
gcloud compute images delete
コマンドを使用して、イメージを削除します。
gcloud compute images deleteIMAGE_NAME
IMAGE_NAME
は、削除するイメージの名前に置き換えます。
images().delete
メソッドに POST
リクエストを送信します。削除するイメージの名前を指定します。
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID /global/images/RESOURCE_ID
次のように置き換えます。
PROJECT_ID
: イメージが属するプロジェクト。RESOURCE_ID
: 削除するイメージの名前。