雲端淘汰和重大變更一般建議工具
雲端淘汰和重大變更一般建議工具會提供雲端淘汰和重大變更相關建議。這項功能會找出即將淘汰的雲端資源,以及即將發生的重大變更,並提供管理這些資源的指南。您可以透過 Google Cloud CLI、API 和 BigQuery Export 查看建議。
事前準備
- 登入 Google Cloud 帳戶。如果您是 Google Cloud新手,歡迎 建立帳戶,親自評估產品在實際工作環境中的成效。新客戶還能獲得價值 $300 美元的免費抵免額,可用於執行、測試及部署工作負載。
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Recommender API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Recommender API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.
- 確認您具備下列角色:
| 說明 | 角色 |
|---|---|
| 查看建議 |
recommender.cloudDeprecationRecommendationViewer
|
| 查看及更新建議 |
recommender.cloudDeprecationRecommendationAdmin
|
必要的角色
本節說明使用雲端淘汰和重大變更一般建議工具所需的角色和權限。
| 角色 | 包含的權限 |
|---|---|
| roles/recommender.cloudDeprecationRecommendationViewer |
|
| roles/recommender.cloudDeprecationRecommendationAdmin |
|
如要進一步瞭解角色和授予存取權的方法,請參閱下列文章:
定價
雲端淘汰和重大變更一般建議工具免費提供。如要瞭解其他定價層級,請參閱「Recommender 定價」。
查看雲端淘汰建議
您可以使用控制台、Google Cloud CLI、Recommender API 或 BigQuery 匯出功能,列出建議。
控制台
前往「Active Assist」。
將「篩選器欄位」設為
Recommender:google.cloud.deprecation.GeneralRecommender。
Google Cloud CLI
這個分頁會顯示使用 Google Cloud CLI 列出建議和洞察資料的指令。
列出建議
gcloud recommender recommendations list \ --billing-project=BILLING_PROJECT_ID \ --project=PROJECT_ID \ --location=LOCATION \ --recommender=google.cloud.deprecation.GeneralRecommender \ --format=yaml列出洞察資訊
gcloud recommender insights list \ --billing-project=BILLING_PROJECT_ID \ --project=PROJECT_ID \ --location=LOCATION \ --insight-type=google.cloud.deprecation.GeneralInsight \ --format=yaml
更改下列內容:
- BILLING_PROJECT_ID,並將其替換為已啟用 Recommender API 的專案 ID。
- 將 PROJECT_ID 替換為 Google Cloud 專案的 ID。
- LOCATION, Google Cloud 建議相關聯資源所在的位置 (例如 global 或 us-central1-a)。
API
這個分頁會顯示使用 Recommender API 列出建議和洞察資料的指令。
可列出建議
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "x-goog-user-project: BILLING_PROJECT_ID" \ "https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.cloud.deprecation.GeneralRecommender/recommendations"列出洞察資訊
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "x-goog-user-project: BILLING_PROJECT_ID" \ "https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.cloud.deprecation.GeneralInsight/insights"
更改下列內容:
- BILLING_PROJECT_ID,並將其替換為已啟用 Recommender API 的專案 ID。
- 將 PROJECT_ID 替換為 Google Cloud 專案的 ID。
- LOCATION, Google Cloud 建議相關聯資源所在的位置 (例如 global 或 us-central1-a)。
BigQuery 匯出內容
這個分頁會顯示指令,列出透過 BigQuery 匯出功能取得的建議。
匯出至 BigQuery 的資料也會包含 Cloud 淘汰建議。透過 BigQuery 匯出功能,您可以查看機構每日的建議快照。
請按照 BigQuery 匯出說明文件,將建議匯出至 BigQuery。
查詢所有淘汰建議:
SELECT * FROM `<project>.<dataset>.recommendations_export` WHERE DATE(_PARTITIONTIME) = "<date>" and recommender = "google.cloud.deprecation.GeneralRecommender"
可用的建議子類型
下表說明可用的建議子類型,以及可揭露的建議子類型。
| 子類型 | 停用或破壞性變更? |
|---|---|
| GCE_METADATA_SERVER_HEADER_WHITESPACE | 為符合 RFC 7230 第 3.2 節的規定,Compute Engine 會在 Compute Engine 中繼資料服務中強制執行 HTTP 要求格式檢查,因為接受格式錯誤的要求可能會導致安全漏洞。 |
請注意,這份表格並不完整,且可能刻意省略安全性相關的淘汰或重大變更。