このページでは、使用していないリソースに対して課金されないようにするため、予約に関する推奨事項を使用して使用率の低いオンデマンド予約を特定し、それらを削除する方法について説明します。
- 予約 Recommender を構成して、受け取る推奨事項の数を増減する方法については、使用率が低い予約に関する推奨事項を構成するまたはアイドル状態の予約に関する推奨事項を構成するをご覧ください。
始める前に
- 制限事項を参照して、予約が低使用率状態の予約に関する推奨事項をサポートしているかどうかを確認します。
-
まだ設定していない場合は、認証を設定します。認証とは、 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 コンソールで、[FinOps ハブ] に移動します。
[上位の推奨事項] セクションで、使用率が低い予約の推奨事項を確認できます。
[上位の推奨事項] セクションで、使用率が低い予約に関連する推奨事項をクリックします。
推奨事項をクリックすると、[分析情報] セクションに、使用率がどの程度低いかが示されます。
推奨事項の詳細を示すページが開きます。[分析情報] セクションで、使用率がどの程度低いかを確認できます。
予約の詳細を表示するには、[予約を表示する] をクリックします。
[予約の詳細を表示] をクリックすると、[使用率] セクションが表示され、予約サイズと実際の使用率が表示されます。
[編集] をクリックすると、[構成] セクションが有効になります。ここで、想定される使用状況に適した VM の数の新しい値を設定できます。
元の予約が不要になった場合は、予約を削除します。
ZONE
は、推奨事項を一覧取得する予約を含むゾーンに置き換えます。PROJECT_ID
はプロジェクトの ID に置き換えます。operationGroups
: 推奨事項を適用する際に実行できるオペレーションのグループdescription
: 推奨事項の説明- google.compute.RightSizeResourceRecommender
- Compute Engine の予約の仕組みに関する詳細を確認する。
- 使用率が低い予約に関する推奨事項を構成する方法を学習する。
- アイドル状態の VM に関する推奨事項を構成する方法を学習する。
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
使用率が低い予約に関する推奨事項を表示するには、
--recommender=google.compute.RightSizeResourceRecommender
フラグを指定してgcloud recommender recommendations list
コマンドを使用します。gcloud recommender recommendations list \ --location=ZONE \ --recommender=google.compute.RightSizeResourceRecommender \ --format=yaml \ --project=PROJECT_ID
次のように置き換えます。
次に例を示します。
gcloud recommender recommendations list \ --location=us-central1-c \ --recommender=google.compute.RightSizeResourceRecommender \ --format=yaml \ --project=my-project
使用率の低い予約がロケーションにない場合、レスポンスは空になります。それ以外の場合、レスポンスには推奨事項ごとに次のフィールドが含まれます。
--- associatedInsights: - insight: projects/953727763714/locations/us-central1-f/insightTypes/google.compute.RightSizeResourceRecommender/insights/ecf77776-4a2a-4e6e-aad2-b7f9c632e5f9 content: operationGroups: - operations: - action: remove path: / resource: //compute.googleapis.com/projects/committed-use-discount-test/zones/us-central1-f/reservations/test-reservation resourceType: compute.googleapis.com/Reservation overview: currentReservation: machineType: n1-standard-1 reservationName: test-reservation reservedMachineCount: '1' zone: us-central1-f description: Save cost by deleting the underutilized reservation test-reservation etag: '"aff724ab8e40e1ef"' lastRefreshTime: '2024-06-10T07:00:00Z' name: projects/953727763714/locations/us-central1-f/recommenders/google.compute.RightSizeResourceRecommender/recommendations/56f8ac5d-8380-4cb8-a76f-bbc270fb4b8e primaryImpact: category: COST costProjection: cost: currencyCode: USD nanos: -199820000 units: '-1072' costInLocalCurrency: currencyCode: USD nanos: -199820000 units: '-1072' duration: 2592000s priority: P2 recommenderSubtype: DELETE_RESERVATION stateInfo: state: ACTIVE targetResources: - //compute.googleapis.com/projects/committed-use-discount-test/zones/us-central1-f/reservations/test-reservation
Google Cloud CLI を使用した推奨事項の活用について詳しくは、gcloud の例をご覧ください。
REST
使用率が低い予約に関する推奨事項を表示するには、
recommendations.list
メソッドにGET
リクエストを送信し、次の推奨事項タイプを使用します。API 呼び出しは次のようになります。
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/ZONE/recommenders/google.compute.RightSizeResourceRecommender/recommendations
次のように置き換えます。
PROJECT_ID
: プロジェクトの ID。ZONE
: 推奨事項を一覧取得するインスタンスを含むゾーン。次の例は、
curl
を使用してリクエストを送信する方法と、関連するサンプル レスポンスを示しています。PROJECT_ID=my-project ZONE=us-central1-c RECOMMENDER_ID=google.compute.RightSizeResourceRecommender curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "x-goog-user-project: $PROJECT_ID" \ https://recommender.googleapis.com/v1/projects/$PROJECT_ID/locations/$ZONE/recommenders/$RECOMMENDER_ID/recommendations
使用率が低い予約に関する推奨事項に対する JSON レスポンスの例:
{ "associatedInsights": [ { "insight": "projects/9531234763714/locations/us-central1-f/insightTypes/google.compute.RightSizeResourceRecommender/insights/ecf77776-4a2a-4e6e-aad2-b7f9c632e5f9" } ], "content": { "operationGroups": [ { "operations": [ { "action": "remove", "path": "/", "resource": "//compute.googleapis.com/projects/committed-use-discount-test/zones/us-central1-f/reservations/test-reservation", "resourceType": "compute.googleapis.com/Reservation" } ] } ], "overview": { "currentReservation": { "machineType": "n1-standard-1", "reservationName": "test-reservation", "reservedMachineCount": "1", "zone": "us-central1-f" } } }, "description": "Save cost by deleting the underutilized reservation test-reservation", "etag": "\"8d5603cac8fa9342\"", "lastRefreshTime": "2024-06-11T07:00:00Z", "name": "projects/9531234763714/locations/us-central1-f/recommenders/google.compute.RightSizeResourceRecommender/recommendations/56f8ac5d-8380-4cb8-a76f-bbc270fb4b8e", "primaryImpact": { "category": "COST", "costProjection": { "cost": { "currencyCode": "USD", "nanos": -199820000, "units": "-1072" }, "costInLocalCurrency": { "currencyCode": "USD", "nanos": -199820000, "units": "-1072" }, "duration": "2592000s" } }, "priority": "P2", "recommenderSubtype": "DELETE_RESERVATION", "stateInfo": { "state": "ACTIVE" }, "targetResources": [ "//compute.googleapis.com/projects/committed-use-discount-test/zones/us-central1-f/reservations/test-reservation" ] }
各フィールドの詳細については、Recommender API のドキュメントをご覧ください。
推奨のレスポンスの解釈
gcloud CLI または REST を介して取得した各推奨事項には、その推奨事項を適用するために実行する一連のオペレーションを示すオペレーション グループが含まれています。使用率が低い予約の場合、オペレーション グループには、予約を削除する
remove
オペレーションが含まれます。{ "action": "remove", "path": "/", "resource": "//compute.googleapis.com/projects/committed-use-discount-test/zones/us-central1-f/reservations/test-reservation", "resourceType": "compute.googleapis.com/Reservation" }
使用率が低い予約に関する推奨事項を適用する
使用率が低い予約に関する推奨事項に基づいて、予約サイズを調整するか、不要になった予約を削除します。
次のステップ
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 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。"],[[["\u003cp\u003eThis document outlines how to use reservation recommendations to identify and delete underutilized on-demand reservations, helping you avoid unnecessary charges.\u003c/p\u003e\n"],["\u003cp\u003ePre-GA (Generally Available) products and features, like the reservation recommendations, are subject to the "Pre-GA Offerings Terms," are provided "as is," and may have limited support.\u003c/p\u003e\n"],["\u003cp\u003eYou can view underutilized reservation recommendations in the FinOps hub in the Google Cloud console, which shows the extent of underutilization and allows you to view or edit reservation details.\u003c/p\u003e\n"],["\u003cp\u003eUsing the \u003ccode\u003egcloud recommender recommendations list\u003c/code\u003e command or a REST API \u003ccode\u003eGET\u003c/code\u003e request, you can retrieve underutilized reservation recommendations, which will then provide you with a description of each recommendation.\u003c/p\u003e\n"],["\u003cp\u003eBased on the recommendations, you can either adjust the reservation size or delete the reservation to optimize resource usage and reduce costs, depending on whether the resource is still needed.\u003c/p\u003e\n"]]],[],null,[]] -