Applying rightsizing recommendations through an AP

2019-07-29 12:58发布

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?

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.

Thanks.

1条回答
趁早两清
2楼-- · 2019-07-29 13:28

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

Where MACHINE-TYPE can be a predefinded machine type or a custom machine type.

Predefined Machine Types

Custom Machine Types

The instance must be stopped. Ephemeral external IP addresses might change.

Best practices recommend creating a snapshot of the disks before changing the instance.

Changing a machine type documentation link

查看更多
登录 后发表回答