本文档介绍如何删除预留。
准备工作
- 查看预留的要求和限制。
-
如果您尚未设置身份验证,请进行设置。身份验证是通过其进行身份验证以访问 Google Cloud 服务和 API 的过程。如需从本地开发环境运行代码或示例,您可以按如下方式向 Compute Engine 进行身份验证。
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
- Set a default region and zone.
在 Google Cloud 控制台中,转到预留页面。
此时会打开预留页面。
选中您要删除的每个预留旁边的复选框。
点击
删除预留。请点击删除来确认操作。
删除预留的操作可能需要一些时间才能完成。
RESERVATION_NAME
:要删除的现有预留的名称。PROJECT_ID
:您用于创建预留的项目的 ID。ZONE
:预留所在的可用区。PROJECT_ID
:您用于创建预留的项目的 ID。ZONE
:预留所在的可用区。RESERVATION_NAME
:要删除的预留的名称。- 了解如何查看预留。
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 CLI 或 REST。
控制台
如需删除预留,请按照以下步骤操作:
gcloud
如需删除预留,请使用
gcloud compute reservations delete
命令。gcloud compute reservations delete RESERVATION_NAME \ --project=PROJECT_ID \ --zone=ZONE
请替换以下内容:
REST
如需删除预留,请向
reservation.delete
方法发出DELETE
请求。DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/reservations/RESERVATION_NAME
替换以下内容:
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-01。
[{ "type": "thumb-down", "id": "hardToUnderstand", "label":"Hard to understand" },{ "type": "thumb-down", "id": "incorrectInformationOrSampleCode", "label":"Incorrect information or sample code" },{ "type": "thumb-down", "id": "missingTheInformationSamplesINeed", "label":"Missing the information/samples I need" },{ "type": "thumb-down", "id": "translationIssue", "label":"翻译问题" },{ "type": "thumb-down", "id": "otherDown", "label":"其他" }] [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"易于理解" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"解决了我的问题" },{ "type": "thumb-up", "id": "otherUp", "label":"其他" }] -