您可以通过替换许可参考或代码,在随用随付 (PAYG) 和自带订阅 (BYOS) 结算模式之间切换。Red Hat Enterprise Linux (RHEL)、RHEL for SAP、SUSE Linux Enterprise Server (SLES) 和 SLES for SAP 支持在 BYOS 和 PAYG 之间切换。 如需详细了解许可代码以及如何确定允许的许可修改,请参阅许可变更和限制。
准备工作
-
如果您尚未设置身份验证,请进行设置。身份验证用于验证您的身份,以便访问 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
-
安装 Google Cloud CLI。 安装完成后,运行以下命令来初始化 Google Cloud CLI:
gcloud init
如果您使用的是外部身份提供方 (IdP),则必须先使用联合身份登录 gcloud CLI。
- Set a default region and zone.
将 BYOS 许可更改为 PAYG 许可
如需 BYOS 替换为 PAYG 许可,请使用 Google Cloud CLI 或 Compute Engine API。
gcloud
如需将磁盘的许可替换为许可引用或代码,请使用
gcloud compute disks update
命令:gcloud compute disks update DISK_NAME \ --replace-license=PREVIOUS_LICENSE,NEW_LICENSE
替换以下内容:
REST
如需替换磁盘的许可,请将新许可添加到请求正文中,并省略之前的许可。调用以下
disks.update
v1 方法:PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT/zones/ZONE/disks/DISK_NAME?paths=licenses --data '{"name":"DISK_NAME", "licenses":["https://www.googleapis.com/compute/v1/NEW_LICENSE"]}'
替换以下内容:
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-09-19。
-