通过GCP中的API应用合理化建议 [英] Applying rightsizing recommendations through an API in GCP
问题描述
我想知道是否有一种方法可以应用通过API调用而不是通过GCP Compute Engine中的UI来为VM提供的权限调整建议?
I wanted to know if there is a way to apply rightsizing recommendation which is provided for VM using an API call instead of doing it through UI in GCP Compute Engine?
例如:如果有一台具有16vCPU和40GB内存配置的虚拟机,并且基于使用量的合理化建议是将配置更改为12vCPU和20GB,是否有可用的API来执行此操作?
For ex: if there is a VM with config 16vCPUs and 40GB mem, and if the rightsizing recommendation on usage basis is to change the config to 12vCPUs and 20GB, Is there an API available which performs this action?
我知道可以通过界面手动完成.
I know it can be done manually through the interface.
谢谢.
推荐答案
您可以使用CLI更改Compute Engine实例的计算机类型.
You can use the CLI to change the machine type for a Compute Engine instance.
gcloud compute instances set-machine-type INSTANCE --machine-type MACHINE-TYPE
其中MACHINE-TYPE可以是预定义的机器类型,也可以是自定义的机器类型.
Where MACHINE-TYPE can be a predefinded machine type or a custom machine type.
该实例必须停止.临时的外部IP地址可能会更改.
The instance must be stopped. Ephemeral external IP addresses might change.
最佳做法建议在更改实例之前创建磁盘快照.
Best practices recommend creating a snapshot of the disks before changing the instance.
这篇关于通过GCP中的API应用合理化建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!